From 98d984991449b6c20d0c24478d34cf13dd25ec9e Mon Sep 17 00:00:00 2001 From: Abijah Date: Thu, 5 Dec 2013 01:24:21 +0000 Subject: [PATCH] Merge in the hosted_migration_20130215 branch to the v0.3_work branch git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@1030 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/.htaccess | 33 +++++++-------- site/app_controller.php | 5 ++- site/build_devbox.cmd | 5 --- site/build_sandbox.cmd | 5 --- site/config/database.php | 12 +++--- .../statement_entries_controller.php | 2 +- site/controllers/transactions_controller.php | 4 +- site/controllers/unit_sizes_controller.php | 4 +- site/controllers/util_controller.php | 40 ++++--------------- site/models/contact.php | 2 +- .../controllers/components/toolbar.php | 4 +- .../debug_kit/views/elements/timer_panel.ctp | 4 +- site/valley_storage.pmgr.htpasswd | 9 +++++ site/views/contacts/edit.ctp | 18 +++++++-- site/webroot/index.php | 2 +- 15 files changed, 65 insertions(+), 84 deletions(-) delete mode 100644 site/build_devbox.cmd delete mode 100644 site/build_sandbox.cmd create mode 100644 site/valley_storage.pmgr.htpasswd diff --git a/site/.htaccess b/site/.htaccess index 861117a..9158f41 100644 --- a/site/.htaccess +++ b/site/.htaccess @@ -1,25 +1,20 @@ - RewriteEngine on - RewriteRule ^$ webroot/ [L] - RewriteRule (.*) webroot/$1 [L] + RewriteEngine on + + RewriteRule ^$ webroot/ [L] + + # Need this prevent a 400 error without trailing / + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule (.*) webroot/$1 [L] + -# Lets deny everyone -- its a clean slate! -order deny,allow -deny from all - -# Now allow local access -# Localhost -# allow from 127.0.0 -# Local subnet -# allow from 192.168.7 +# Need to make sure directories can't be listed, since the rewrite +# rule excludes rewriting when an actual directory is requested +Options -Indexes # Provide a mechanism for user authentication -AuthType Digest -AuthName "Property Manager" -AuthUserFile "D:/Website/auth/pmgr.htpasswd" +AuthType Basic +AuthName "Valley Storage" +AuthUserFile "/home/perki2/valley_storage.pmgr.htpasswd" Require valid-user - -# Instead of satisfy all (too restrictive) -# This allows EITHER local domain OR authenticated user -satisfy any diff --git a/site/app_controller.php b/site/app_controller.php index 32f7f3c..be78c98 100644 --- a/site/app_controller.php +++ b/site/app_controller.php @@ -37,7 +37,7 @@ class AppController extends Controller { var $uses = array('Option', 'Permission'); var $helpers = array('Html', 'Form', 'Javascript', 'Format', 'Time', 'Grid'); - var $components = array('DebugKit.Toolbar'); + //var $components = array('DebugKit.Toolbar'); var $sidemenu = array('areas' => array('SITE' => false, 'REPORT' => false, 'CONTROLLER' => false, 'ACTION' => false, 'SANDBOX' => false)); var $std_area = 10; @@ -464,7 +464,8 @@ class AppController extends Controller { App::import('Helper', 'Html'); $url = HtmlHelper::url($url, true); - if (headers_sent()) { + if (headers_sent() || + ($this->dev() && $this->Option->enabled('dev'))) { // If we've already sent the headers, it's because // we're debugging, and our debug output has gotten // out before the redirect. That's probably a good diff --git a/site/build_devbox.cmd b/site/build_devbox.cmd deleted file mode 100644 index 79b99d5..0000000 --- a/site/build_devbox.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -mysqldump --user=pmgr --password=pmgruser --opt property_manager > H:\pmgr_dev.sql -mysql --user=pmgr --password=pmgruser --database=pmgr_dev < H:\pmgr_dev.sql -del H:\pmgr_dev.sql -echo Build Complete! diff --git a/site/build_sandbox.cmd b/site/build_sandbox.cmd deleted file mode 100644 index 3143b81..0000000 --- a/site/build_sandbox.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -mysqldump --user=pmgr --password=pmgruser --opt property_manager > H:\pmgr_sand.sql -mysql --user=pmgr --password=pmgruser --database=pmgr_sand < H:\pmgr_sand.sql -del H:\pmgr_sand.sql -echo Build Complete! diff --git a/site/config/database.php b/site/config/database.php index 6cdddfa..ea084f7 100644 --- a/site/config/database.php +++ b/site/config/database.php @@ -5,17 +5,17 @@ class DATABASE_CONFIG { 'driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', - 'login' => 'pmgr', - 'password' => 'pmgruser', - 'database' => 'property_manager', - 'prefix' => 'pmgr_', + 'login' => 'perki2_pmgruser', + 'password' => 'pmgrauth', + 'database' => 'perki2_pmgr', + 'prefix' => '', ); function __construct() { if (devbox()) - $this->default['database'] = 'pmgr_dev'; + $this->default['database'] = 'perki2_pmgr_dev'; if (sandbox()) - $this->default['database'] = 'pmgr_sand'; + $this->default['database'] = 'perki2_pmgr_sand'; } } ?> \ No newline at end of file diff --git a/site/controllers/statement_entries_controller.php b/site/controllers/statement_entries_controller.php index f1ecf6c..0006445 100644 --- a/site/controllers/statement_entries_controller.php +++ b/site/controllers/statement_entries_controller.php @@ -297,7 +297,7 @@ class StatementEntriesController extends AppController { 'conditions' => array('LedgerEntry.account_id' => $this->StatementEntry->Account->securityDepositAccountID(), "effective_date >= $datefrom", "effective_date <= $dateto", - 'StatementEntry.id = (SELECT MIN(id) FROM pmgr_statement_entries WHERE transaction_id = `Transaction`.id)' + 'StatementEntry.id = (SELECT MIN(id) FROM statement_entries WHERE transaction_id = `Transaction`.id)' ), 'group' => array('YEAR(effective_date)', 'MONTH(effective_date)', 'Account.id'), 'order' => array('YEAR(effective_date) DESC', 'MONTH(effective_date) DESC', 'Account.type', 'Account.name'), diff --git a/site/controllers/transactions_controller.php b/site/controllers/transactions_controller.php index b7b42d3..8f908ea 100644 --- a/site/controllers/transactions_controller.php +++ b/site/controllers/transactions_controller.php @@ -503,8 +503,8 @@ class TransactionsController extends AppController { foreach ($deposit['types'] AS $type) $deposit_total += $type['total']; - if ($deposit['Transaction']['amount'] != $deposit_total) - $this->INTERNAL_ERROR("Deposit items do not add up to deposit slip total"); + if (abs($deposit['Transaction']['amount'] - $deposit_total) >= .001) + $this->INTERNAL_ERROR("Deposit items ($deposit_total) do not add up to deposit slip total (".$deposit['Transaction']['amount'].")"); $this->addSideMenuLink('View', array('action' => 'view', $id), null, diff --git a/site/controllers/unit_sizes_controller.php b/site/controllers/unit_sizes_controller.php index ccc341e..584614b 100644 --- a/site/controllers/unit_sizes_controller.php +++ b/site/controllers/unit_sizes_controller.php @@ -91,8 +91,8 @@ class UnitSizesController extends AppController { $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionUnavailable() . ', 1, 0)) AS unavailable'; $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionAvailable() . ', 1, 0)) AS available'; $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionOccupied() . ', 1, 0)) AS occupied'; - $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionOccupied() . ', 0, 1)) / COUNT(unit.id) AS vacancy'; - $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionOccupied() . ', 1, 0)) / COUNT(unit.id) AS occupancy'; + $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionOccupied() . ', 0, 1)) / COUNT(Unit.id) AS vacancy'; + $fields[] = 'SUM(IF(' . $this->UnitSize->Unit->conditionOccupied() . ', 1, 0)) / COUNT(Unit.id) AS occupancy'; return $fields; } diff --git a/site/controllers/util_controller.php b/site/controllers/util_controller.php index 3a4ea43..d696029 100644 --- a/site/controllers/util_controller.php +++ b/site/controllers/util_controller.php @@ -4,31 +4,6 @@ class UtilController extends AppController { var $uses = array(); - /************************************************************************** - ************************************************************************** - ************************************************************************** - * function: reset_data - * - Development function. TO BE DELETED - */ - - function reset_data() { - $this->layout = null; - $this->autoLayout = false; - $this->autoRender = false; - Configure::write('debug', '0'); - $script = $_SERVER['DOCUMENT_ROOT'] . '/pmgr/build.cmd'; - echo "

" . date('r') . "\n"; - //echo "

Script: $script" . "\n"; - $handle = popen($script . ' 2>&1', 'r'); - //echo "

Handle: $handle; " . gettype($handle) . "\n"; - echo "

\n";
-    while (($read = fread($handle, 2096))) {
-      echo $read;
-    }
-    echo "
\n"; - pclose($handle); - } - /************************************************************************** ************************************************************************** ************************************************************************** @@ -40,21 +15,20 @@ class UtilController extends AppController { $this->autoLayout = false; $this->autoRender = false; Configure::write('debug', '0'); - $script = preg_replace('%/webroot/index.php$%', - '/build_'.$type.'box.cmd', - $_SERVER['SCRIPT_FILENAME']); - // REVISIT : 20090828 - // Just use system call - $handle = popen($script . ' 2>&1', 'r'); + $usrpass = '--user=perki2_pmgruser --password=pmgrauth'; + $boxdb = 'perki2_pmgr_' . $type; + + $handle = popen("mysqldump $usrpass --opt perki2_pmgr" . + " | mysql $usrpass --database=$boxdb", 'r'); while (($read = fread($handle, 2096))) { // Do nothing } pclose($handle); $url = $_SERVER['HTTP_REFERER']; - if (empty($url)) - $url = "/"; + if (empty($url) || $url == 'undefined') + $url = "/$type"; $this->redirect($url); } diff --git a/site/models/contact.php b/site/models/contact.php index 43ad9e0..554d91f 100644 --- a/site/models/contact.php +++ b/site/models/contact.php @@ -91,7 +91,7 @@ class Contact extends AppModel { // If the user has entered all new data, we need to // save that as a brand new entry. - if (!isset($item['id'])) { + if (!isset($item['id']) || $item['source'] == 'new') { $I = new $class(); $I->create(); if (!$I->save($item, false)) { diff --git a/site/plugins/debug_kit/controllers/components/toolbar.php b/site/plugins/debug_kit/controllers/components/toolbar.php index 0b72acb..64adf7a 100644 --- a/site/plugins/debug_kit/controllers/components/toolbar.php +++ b/site/plugins/debug_kit/controllers/components/toolbar.php @@ -163,7 +163,7 @@ class ToolbarComponent extends Object { trigger_error(sprintf(__('Could not load DebugToolbar panel %s', true), $panel), E_USER_WARNING); continue; } - $panelObj =& new $className(); + $panelObj = new $className(); if (is_subclass_of($panelObj, 'DebugPanel') || is_subclass_of($panelObj, 'debugpanel')) { $this->panels[$panel] =& $panelObj; } @@ -456,7 +456,7 @@ class LogPanel extends DebugPanel { * @return array */ function _parseFile($filename) { - $file =& new File($filename); + $file = new File($filename); $contents = $file->read(); $timePattern = '/(\d{4}-\d{2}\-\d{2}\s\d{1,2}\:\d{1,2}\:\d{1,2})/'; $chunks = preg_split($timePattern, $contents, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); diff --git a/site/plugins/debug_kit/views/elements/timer_panel.ctp b/site/plugins/debug_kit/views/elements/timer_panel.ctp index 1ec74d6..3d9d594 100644 --- a/site/plugins/debug_kit/views/elements/timer_panel.ctp +++ b/site/plugins/debug_kit/views/elements/timer_panel.ctp @@ -30,14 +30,14 @@ $timers = DebugKitDebugger::getTimers(); ?>

- precision(DebugKitDebugger::requestTime(), 6)); ?> + message(__('Total Request Time:', true), $totalTime)?>

$timeInfo): $rows[] = array( $timeInfo['message'], - $number->precision($timeInfo['time'], 6) + sprintf(__('%.6s', true), $timeInfo['time']) ); $headers = array(__('Message', true), __('time in seconds', true)); endforeach; diff --git a/site/valley_storage.pmgr.htpasswd b/site/valley_storage.pmgr.htpasswd new file mode 100644 index 0000000..343a1ef --- /dev/null +++ b/site/valley_storage.pmgr.htpasswd @@ -0,0 +1,9 @@ +abijah:Property Manager:a2369e3cc9e231ea6f02ce799a8b9970 +anja:Property Manager:4539d5a6e58dd5895f2f3891d29705b0 +kevin:Property Manager:f01accc9f5e5cdfc028dcf0cca837cf1 +adam:Property Manager:ae6835569bb2fc0a0a4a773580ac8cda +shirley:Property Manager:e7e9d674c700796c99cdbf3cf105e739 +admin:Property Manager:bab2226685d9b4b66220db8df80f1822 +dev:Property Manager:e5c27b3c025e47239a45daceea2c0a00 +vasst:Property Manager:523abc6c2b8458b463d5a9baa4f58f2e +answerfirst:Property Manager:6ac128447fab8be985c74ba7539c39b3 diff --git a/site/views/contacts/edit.ctp b/site/views/contacts/edit.ctp index 8ba1941..bacaa7a 100644 --- a/site/views/contacts/edit.ctp +++ b/site/views/contacts/edit.ctp @@ -68,7 +68,7 @@ function contactMethodDiv($obj, $type, $legend, $values = null) { '' . "\n" . // BEGIN method-div - '
' . "\n" . $obj->element ('form_table', @@ -131,14 +131,18 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { elseif ($stype === 'new') { $fields = array ('type' => array('label_attributes' => array('class' => 'required'), - 'opts' => array('options' => $obj->varstore['phoneTypes']), + 'opts' => array('autocomplete' => 'off', + 'options' => $obj->varstore['phoneTypes']), 'after' => "Physical type of the phone."), 'phone' => array('label_attributes' => array('class' => 'required empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Required: Phone number."), 'ext' => array('name' => "Extension", 'label_attributes' => array('class' => 'optional empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Optional: Extension number."), 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Optional: Comments about this phone number."), ); } @@ -167,17 +171,23 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { elseif ($stype === 'new') { $fields = array ('address' => array('label_attributes' => array('class' => 'required empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Required: First line of mailing address."), 'city' => array('label_attributes' => array('class' => 'required empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Required."), 'state' => array('label_attributes' => array('class' => 'required empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Required."), 'postcode' => array('name' => 'Zip Code', 'label_attributes' => array('class' => 'required empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Required."), 'country' => array('label_attributes' => array('class' => 'optional empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Optional: USA is presumed."), 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Optional: Comments about this mailing address."), ); } @@ -208,8 +218,10 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { elseif ($stype === 'new') { $fields = array ('email' => array('label_attributes' => array('class' => 'required empty'), - 'after' => "Required: E-mail address."), + 'opts' => array('autocomplete' => 'off'), + 'after' => "Required: E-mail address."), 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'opts' => array('autocomplete' => 'off'), 'after' => "Optional: Comments about this email address."), ); } diff --git a/site/webroot/index.php b/site/webroot/index.php index 9c2e5a8..2f0125f 100644 --- a/site/webroot/index.php +++ b/site/webroot/index.php @@ -55,7 +55,7 @@ * */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { - define('CAKE_CORE_INCLUDE_PATH', 'D:\Website\localhost\CakePHP'); + define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . DS . 'CakePHP'); } /**