Skip to content

Commit

Permalink
4.1 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Jennings committed Dec 3, 2012
1 parent 1d44391 commit e946ef4
Show file tree
Hide file tree
Showing 1,275 changed files with 319,703 additions and 222 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
*.un~
build/test/*.xml
build/build.properties
build/coverage
build/extended
config.php
modules/db/conf/protean-conf.php
modules/db/sql/sqldb.map
modules/db/sql/schema.sql
modules/list/misc/
modules/db/lib/om
modules/db/lib/map
build/runtime-conf.xml
build/buildtime-conf.xml
build/schema-transformed.xml
build/schema.xml
build/tests
Expand Down
2 changes: 1 addition & 1 deletion build/build-dist.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ propel.database.classname = DebugPDO
propel.mysql.path = /usr/bin/mysql
propel.mysql.tableType = InnoDB

propel.generator.buildpath = /usr/lib/php/data/propel_generator
propel.generator.buildpath = /usr/lib/php/pear/data/propel_generator
propel.addGenericAccessors = true
propel.addGenericMutators = true
propel.addTimeStamp = false
37 changes: 29 additions & 8 deletions config-dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


// BUILD SETTINGS
define('PF_VERSION','4.0');
define('PF_VERSION','4.1');
define('PF_ENVIRONMENT', 'development');


Expand Down Expand Up @@ -60,14 +60,10 @@


// TEMPLATE/FORM SETTINGS
define('PF_TEMPLATE_FORCE_RECOMPILE', true);
define('PF_TEMPLATE_FORCE_RECOMPILE', false);
define('PF_FORM_FIELD_ERROR_HIGHLIGHTING', true);


// CMS SETTINGS
define('PF_CMS_ENABLED', false);


// SESSION SETTINGS
define('PF_SESSION_NAME', 'id');
define('PF_SESSION_PERSIST_NAME', 'persist');
Expand All @@ -83,12 +79,21 @@
define('PF_CACHE_ENABLED', true);
define('PF_CACHE_USER_TTL', 3600);
define('PF_CACHE_CONTROLLER_MAP', false);
define('PF_CACHE_TEMPLATES', false);

define('PF_CACHE_MEMCACHE_SERVER_HOST_1', false);
define('PF_CACHE_MEMCACHE_SERVER_HOST_2', false);
define('PF_CACHE_MEMCACHE_SERVER_HOST_3', false);
define('PF_CACHE_MEMCACHE_SERVER_HOST_4', false);

define('PF_CDN_URL', '%%PHING_PROTEAN_URL%%');


// JOB QUEUE SETTINGS
define('PF_JOBQUEUE_HOST', '127.0.0.1');
define('PF_JOBQUEUE_PORT', 11300);
define('PF_JOBQUEUE_CONN_TIMEOUT', null);


// MAILER SETTINGS
define('PF_EMAIL_USE_SMTP', false);
Expand Down Expand Up @@ -127,8 +132,7 @@
define('PF_SHOP_EMAIL_ADMINS', false);

define('PF_SHOP_GATEWAY_DEBUG', true);
define('PF_SHOP_GATEWAY_LOG', '%%PHING_PROTEAN_BASEDIR%%/logs/pf_authnet_gateway.log');
define('PF_SHOP_CIM_LOG', '%%PHING_PROTEAN_BASEDIR%%/logs/pf_authnet_cim.log');
define('PF_SHOP_GATEWAY_LOG', '%%PHING_PROTEAN_BASEDIR%%/logs/pf_gateway.log');

define('PF_SHOP_GATEWAY_AUTHNET_TEST_REQUEST', true);
define('PF_SHOP_GATEWAY_AUTHNET_LOGIN', 'abc');
Expand All @@ -140,6 +144,23 @@
define('PF_SHOP_GATEWAY_AUTHNET_CIM_PORT', '443');
define('PF_SHOP_GATEWAY_AUTHNET_CIM_PATH', '/xml/v1/request.api');

define('PF_SHOP_GATEWAY_STRIPE_TEST_REQUEST', true);
define('PF_SHOP_GATEWAY_STRIPE_TEST_SECRET_KEY', 'D7bES9biF1eeGhBENJrnQO6tDVMrnt5o');
define('PF_SHOP_GATEWAY_STRIPE_TEST_PUBLISH_KEY', 'pk_3GALjNFDV4KXTd4QPkLBibsHpXkar');
define('PF_SHOP_GATEWAY_STRIPE_LIVE_SECRET_KEY', 'sTHNScUGnEXIhVcmiibWrSPYCevHlx1Y');
define('PF_SHOP_GATEWAY_STRIPE_LIVE_PUBLISH_KEY', 'pk_sn1AJYs7zVjkWG6ubFBj2rpMFy9Ko');
define('PF_SHOP_GATEWAY_STRIPE_SCRIPT', 'https://js.stripe.com/v1/');

define('PF_SHOP_GATEWAY_PAYPAL_TEST_REQUEST', true);
define('PF_SHOP_GATEWAY_PAYPAL_LOG', '/www/standard/www.missouriquiltco.com/logs/pf_paypal.log');
define('PF_SHOP_GATEWAY_PAYPAL_SELLER_EMAIL', '[email protected]');

define('PF_USPS_RATECALCULATOR_USERNAME', '493MISSO0374');

define('PF_ES_HOST_1', 'localhost');
define('PF_ES_HOST_2', false);
define('PF_ES_HOST_3', false);
define('PF_ES_HOST_4', false);

// SITE SPECIFIC DEFINES

Expand Down
25 changes: 25 additions & 0 deletions crossdomain.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>


<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->

<!-- Most restrictive policy: -->
<site-control permitted-cross-domain-policies="none"/>



<!-- Least restrictive policy: -->
<!--
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
-->
<!--
If you host a crossdomain.xml file with allow-access-from domain=“*”
and don’t understand all of the points described here, you probably
have a nasty security vulnerability. ~ simon willison
-->

</cross-domain-policy>
81 changes: 81 additions & 0 deletions modules/api/lib/httprequest.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**************************************************************************\
* Protean Framework *
* https://github.com/erictj/protean *
* Copyright (c) 2006-2012, Eric Jennings. All rights reserved. *
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the BSD License as described in license.txt. *
\**************************************************************************/
/**
@package api
*/
class PFHttpRequest {

public function get($url, $credentials, $status=null, $wait=3) {
return $this->request('get', $url, $credentials, null, $status, $wait);
}

public function post($url, $credentials, $data, $status=null, $wait=3) {
return $this->request('post', $url, $credentials, $data, $status, $wait);
}

public function put($url, $credentials, $data, $status=null, $wait=3) {
return $this->request('put', $url, $credentials, $data, $status, $wait);
}

public function delete($url, $credentials, $status=null, $wait=3) {
return $this->request('delete', $url, $credentials, null, $status, $wait);
}

protected function request($verb, $url, $credentials, $fields=null, $status=null) {
$time = microtime(true);

//$fields = (is_array($fields)) ? http_build_query($fields) : $fields;
printr($verb);
printr($url);
printr($credentials);
printr($fields);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $verb);
//curl_setopt($ch, CURLOPT_HEADER, TRUE);
if ($credentials) {
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
}
if ($verb == 'post' || $verb == 'put') {
curl_setopt($ch, CURLOPT_POSTFIELDS, array($fields));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
}
//curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$head = curl_exec($ch);
if (!$head) {
printr(curl_error($ch));
return false;
}

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

printr('CURL VERB:');
printr($verb);
printr('CURL OUTPUT:');
printr($head);

if ($status === null) {
if ($httpCode < 400) {
return $head;
} else {
return false;
}
} elseif ($status == $httpCode) {
return $head;
}

return false;
}
}
?>
63 changes: 63 additions & 0 deletions modules/api/lib/jobqueue.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**************************************************************************\
* Protean Framework *
* https://github.com/erictj/protean *
* Copyright (c) 2006-2012, Eric Jennings. All rights reserved. *
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the BSD License as described in license.txt. *
\**************************************************************************/
/**
@package api
*/
require_once('modules/thirdparty/pheanstalk/pheanstalk_init.php');

class PFJobQueue {

protected $bs;

public function __construct() {
$this->bs = new Pheanstalk(PF_JOBQUEUE_HOST, PF_JOBQUEUE_PORT, PF_JOBQUEUE_CONN_TIMEOUT);
}

public function put($tube, $payload) {
return $this->bs->putInTube($tube, $payload);
}

public function reserve($tube) {
return $this->bs->reserveFromTube($tube);
}

public function bury($job) {
return $this->bs->bury($job);
}

public function delete($job) {
return $this->bs->delete($job);
}

public function statsTube($tube) {
return $this->bs->statsTube($tube);
}

public function peekReady($tube) {
return $this->bs->peekReady($tube);
}

public function clearTube($tube) {
try {
$stats = $this->statsTube($tube);
} catch (Exception $e) {
if ($e->getMessage() == 'Server reported NOT_FOUND') {
return false;
}
}

while ($stats->{'current-jobs-ready'} > 0) {
$this->delete($this->peekReady($tube));
$stats = $this->statsTube($tube);
}
}
}

?>
81 changes: 81 additions & 0 deletions modules/api/test/unit/httprequest.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**************************************************************************\
* Protean Framework *
* https://github.com/erictj/protean *
* Copyright (c) 2006-2012, Eric Jennings. All rights reserved. *
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the BSD License as described in license.txt. *
\**************************************************************************/
/**
@package api
*/
class PFHttpRequest {

public function get($url, $credentials, $status=null, $wait=3) {
return $this->request('get', $url, $credentials, null, $status, $wait);
}

public function post($url, $credentials, $data, $status=null, $wait=3) {
return $this->request('post', $url, $credentials, $data, $status, $wait);
}

public function put($url, $credentials, $data, $status=null, $wait=3) {
return $this->request('put', $url, $credentials, $data, $status, $wait);
}

public function delete($url, $credentials, $status=null, $wait=3) {
return $this->request('delete', $url, $credentials, null, $status, $wait);
}

protected function request($verb, $url, $credentials, $fields=null, $status=null) {
$time = microtime(true);

//$fields = (is_array($fields)) ? http_build_query($fields) : $fields;
printr($verb);
printr($url);
printr($credentials);
printr($fields);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $verb);
//curl_setopt($ch, CURLOPT_HEADER, TRUE);
if ($credentials) {
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
}
if ($verb == 'post' || $verb == 'put') {
curl_setopt($ch, CURLOPT_POSTFIELDS, array($fields));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
}
//curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$head = curl_exec($ch);
if (!$head) {
printr(curl_error($ch));
return false;
}

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

printr('CURL VERB:');
printr($verb);
printr('CURL OUTPUT:');
printr($head);

if ($status === null) {
if ($httpCode < 400) {
return $head;
} else {
return false;
}
} elseif ($status == $httpCode) {
return $head;
}

return false;
}
}
?>
Loading

0 comments on commit e946ef4

Please sign in to comment.