Skip to content

Commit

Permalink
Merge branch 'local/svn/1.2.x.x' into 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gwoo committed Jul 24, 2009
2 parents 97e55d7 + 9d7b560 commit b2c3000
Show file tree
Hide file tree
Showing 25 changed files with 13,667 additions and 13,505 deletions.
4 changes: 2 additions & 2 deletions cake/console/libs/api.php
Expand Up @@ -66,7 +66,7 @@ function main() {
return $this->help();
}

$type = low($this->args[0]);
$type = strtolower($this->args[0]);

if (isset($this->paths[$type])) {
$path = $this->paths[$type];
Expand Down Expand Up @@ -202,7 +202,7 @@ function __parseClass($path) {

if (strpos($method, '__') === false && $method[0] != '_') {
$parsed[$method] = array(
'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
'comment' => str_replace(array('/*', '*/', '*'), '', trim($result[1][$key])),
'method' => $method,
'parameters' => trim($result[3][$key])
);
Expand Down
18 changes: 9 additions & 9 deletions cake/console/libs/shell.php
Expand Up @@ -149,10 +149,10 @@ function __construct(&$dispatch) {
ClassRegistry::map($this->name, $this->alias);

if (!PHP5 && isset($this->args[0])) {
if (strpos($this->name, low(Inflector::camelize($this->args[0]))) !== false) {
if (strpos($this->name, strtolower(Inflector::camelize($this->args[0]))) !== false) {
$dispatch->shiftArgs();
}
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
$dispatch->shiftArgs();
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ function in($prompt, $options = null, $default = null) {
}
}
if (is_array($options)) {
while ($in == '' || ($in && (!in_array(low($in), $options) && !in_array(up($in), $options)) && !in_array($in, $options))) {
while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
$in = $this->Dispatch->getInput($prompt, $options, $default);
}
}
Expand Down Expand Up @@ -427,10 +427,10 @@ function createFile ($path, $contents) {
$this->out("\n" . sprintf(__("Creating file %s", true), $path));
if (is_file($path) && $this->interactive === true) {
$key = $this->in(__("File exists, overwrite?", true). " {$path}", array('y', 'n', 'q'), 'n');
if (low($key) == 'q') {
if (strtolower($key) == 'q') {
$this->out(__("Quitting.", true) ."\n");
exit;
} elseif (low($key) != 'y') {
} elseif (strtolower($key) != 'y') {
$this->out(__("Skip", true) ." {$path}\n");
return false;
}
Expand Down Expand Up @@ -472,7 +472,7 @@ function _checkUnitTest() {
return true;
}
$unitTest = $this->in('SimpleTest is not installed. Do you want to bake unit test files anyway?', array('y','n'), 'y');
$result = low($unitTest) == 'y' || low($unitTest) == 'yes';
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';

if ($result) {
$this->out("\nYou can download SimpleTest from http://simpletest.org", true);
Expand All @@ -488,8 +488,8 @@ function _checkUnitTest() {
*/
function shortPath($file) {
$shortPath = str_replace(ROOT, null, $file);
$shortPath = str_replace('..'.DS, '', $shortPath);
return r(DS.DS, DS, $shortPath);
$shortPath = str_replace('..' . DS, '', $shortPath);
return str_replace(DS . DS, DS, $shortPath);
}
/**
* Checks for Configure::read('Routing.admin') and forces user to input it if not enabled
Expand Down Expand Up @@ -528,7 +528,7 @@ function getAdmin() {
* @access protected
*/
function _controllerPath($name) {
return low(Inflector::underscore($name));
return strtolower(Inflector::underscore($name));
}
/**
* Creates the proper controller plural name for the specified controller class name
Expand Down
28 changes: 14 additions & 14 deletions cake/console/libs/tasks/controller.php
Expand Up @@ -120,37 +120,37 @@ function __interactive($controllerName = false) {
$this->out("Baking {$controllerName}Controller");
$this->hr();

$controllerFile = low(Inflector::underscore($controllerName));
$controllerFile = strtolower(Inflector::underscore($controllerName));

$question[] = __("Would you like to build your controller interactively?", true);
if (file_exists($this->path . $controllerFile .'_controller.php')) {
$question[] = sprintf(__("Warning: Choosing no will overwrite the %sController.", true), $controllerName);
}
$doItInteractive = $this->in(join("\n", $question), array('y','n'), 'y');

if (low($doItInteractive) == 'y' || low($doItInteractive) == 'yes') {
if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes') {
$this->interactive = true;

$wannaUseScaffold = $this->in(__("Would you like to use scaffolding?", true), array('y','n'), 'n');

if (low($wannaUseScaffold) == 'n' || low($wannaUseScaffold) == 'no') {
if (strtolower($wannaUseScaffold) == 'n' || strtolower($wannaUseScaffold) == 'no') {

$wannaDoScaffolding = $this->in(__("Would you like to include some basic class methods (index(), add(), view(), edit())?", true), array('y','n'), 'n');

if (low($wannaDoScaffolding) == 'y' || low($wannaDoScaffolding) == 'yes') {
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes') {
$wannaDoAdmin = $this->in(__("Would you like to create the methods for admin routing?", true), array('y','n'), 'n');
}

$wannaDoHelpers = $this->in(__("Would you like this controller to use other helpers besides HtmlHelper and FormHelper?", true), array('y','n'), 'n');

if (low($wannaDoHelpers) == 'y' || low($wannaDoHelpers) == 'yes') {
if (strtolower($wannaDoHelpers) == 'y' || strtolower($wannaDoHelpers) == 'yes') {
$helpersList = $this->in(__("Please provide a comma separated list of the other helper names you'd like to use.\nExample: 'Ajax, Javascript, Time'", true));
$helpersListTrimmed = str_replace(' ', '', $helpersList);
$helpers = explode(',', $helpersListTrimmed);
}
$wannaDoComponents = $this->in(__("Would you like this controller to use any components?", true), array('y','n'), 'n');

if (low($wannaDoComponents) == 'y' || low($wannaDoComponents) == 'yes') {
if (strtolower($wannaDoComponents) == 'y' || strtolower($wannaDoComponents) == 'yes') {
$componentsList = $this->in(__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'", true));
$componentsListTrimmed = str_replace(' ', '', $componentsList);
$components = explode(',', $componentsListTrimmed);
Expand All @@ -163,20 +163,20 @@ function __interactive($controllerName = false) {
} else {
$wannaDoScaffolding = $this->in(__("Would you like to include some basic class methods (index(), add(), view(), edit())?", true), array('y','n'), 'y');

if (low($wannaDoScaffolding) == 'y' || low($wannaDoScaffolding) == 'yes') {
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes') {
$wannaDoAdmin = $this->in(__("Would you like to create the methods for admin routing?", true), array('y','n'), 'y');
}
}
$admin = false;

if ((low($wannaDoAdmin) == 'y' || low($wannaDoAdmin) == 'yes')) {
if ((strtolower($wannaDoAdmin) == 'y' || strtolower($wannaDoAdmin) == 'yes')) {
$admin = $this->getAdmin();
}

if (low($wannaDoScaffolding) == 'y' || low($wannaDoScaffolding) == 'yes') {
$actions = $this->bakeActions($controllerName, null, in_array(low($wannaUseSession), array('y', 'yes')));
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes') {
$actions = $this->bakeActions($controllerName, null, in_array(strtolower($wannaUseSession), array('y', 'yes')));
if ($admin) {
$actions .= $this->bakeActions($controllerName, $admin, in_array(low($wannaUseSession), array('y', 'yes')));
$actions .= $this->bakeActions($controllerName, $admin, in_array(strtolower($wannaUseSession), array('y', 'yes')));
}
}

Expand All @@ -187,7 +187,7 @@ function __interactive($controllerName = false) {
$this->hr();
$this->out("Controller Name: $controllerName");

if (low($wannaUseScaffold) == 'y' || low($wannaUseScaffold) == 'yes') {
if (strtolower($wannaUseScaffold) == 'y' || strtolower($wannaUseScaffold) == 'yes') {
$this->out(" var \$scaffold;");
$actions = 'scaffold';
}
Expand Down Expand Up @@ -218,7 +218,7 @@ function __interactive($controllerName = false) {
$this->hr();
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y');

if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
$baked = $this->bake($controllerName, $actions, $helpers, $components, $uses);
if ($baked && $this->_checkUnitTest()) {
$this->bakeTest($controllerName);
Expand Down Expand Up @@ -408,7 +408,7 @@ function bake($controllerName, $actions = '', $helpers = null, $components = nul
$out .= "class $controllerName" . "Controller extends {$this->plugin}AppController {\n\n";
$out .= "\tvar \$name = '$controllerName';\n";

if (low($actions) == 'scaffold') {
if (strtolower($actions) == 'scaffold') {
$out .= "\tvar \$scaffold;\n";
} else {
if (count($uses)) {
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/db_config.php
Expand Up @@ -240,7 +240,7 @@ function __verify($config) {
$this->hr();
$looksGood = $this->in('Look okay?', array('y', 'n'), 'y');

if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
return $config;
}
return false;
Expand Down
16 changes: 8 additions & 8 deletions cake/console/libs/tasks/model.php
Expand Up @@ -112,11 +112,11 @@ function __interactive() {
$tableIsGood = $this->in(__('Do you want to use this table?', true), array('y','n'), 'y');
}

if (low($tableIsGood) == 'n' || low($tableIsGood) == 'no') {
if (strtolower($tableIsGood) == 'n' || strtolower($tableIsGood) == 'no') {
$useTable = $this->in(__('What is the name of the table (enter "null" to use NO table)?', true));
}

while ($tableIsGood == false && low($useTable) != 'null') {
while ($tableIsGood == false && strtolower($useTable) != 'null') {
if (is_array($this->__tables) && !in_array($useTable, $this->__tables)) {
$fullTableName = $db->fullTableName($useTable, false);
$this->out($fullTableName . ' does not exist.');
Expand Down Expand Up @@ -144,12 +144,12 @@ function __interactive() {
}
}

if (array_search($useTable, $this->__tables) !== false && (low($wannaDoValidation) == 'y' || low($wannaDoValidation) == 'yes')) {
if (array_search($useTable, $this->__tables) !== false && (strtolower($wannaDoValidation) == 'y' || strtolower($wannaDoValidation) == 'yes')) {
$validate = $this->doValidation($tempModel);
}

$wannaDoAssoc = $this->in(__('Would you like to define model associations (hasMany, hasOne, belongsTo, etc.)?', true), array('y','n'), 'y');
if ((low($wannaDoAssoc) == 'y' || low($wannaDoAssoc) == 'yes')) {
if ((strtolower($wannaDoAssoc) == 'y' || strtolower($wannaDoAssoc) == 'yes')) {
$associations = $this->doAssociations($tempModel);
}

Expand Down Expand Up @@ -201,7 +201,7 @@ function __interactive() {
$this->hr();
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y');

if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
if ($this->bake($currentModelName, $associations, $validate, $primaryKey, $useTable, $useDbConfig)) {
if ($this->_checkUnitTest()) {
$this->bakeTest($currentModelName, $useTable, $associations);
Expand Down Expand Up @@ -401,7 +401,7 @@ function doAssociations(&$model, $interactive = true) {
$prompt = "{$model->name} {$type} {$associations[$type][$i]['alias']}";
$response = $this->in("{$prompt}?", array('y','n'), 'y');

if ('n' == low($response) || 'no' == low($response)) {
if ('n' == strtolower($response) || 'no' == strtolower($response)) {
unset($associations[$type][$i]);
} else {
if ($model->name === $associations[$type][$i]['alias']) {
Expand All @@ -414,7 +414,7 @@ function doAssociations(&$model, $interactive = true) {

$alternateAlias = $this->in(sprintf(__('This is a self join. Use %s as the alias', true), $alias), array('y', 'n'), 'y');

if ('n' == low($alternateAlias) || 'no' == low($alternateAlias)) {
if ('n' == strtolower($alternateAlias) || 'no' == strtolower($alternateAlias)) {
$associations[$type][$i]['alias'] = $this->in(__('Specify an alternate alias.', true));
} else {
$associations[$type][$i]['alias'] = $alias;
Expand All @@ -429,7 +429,7 @@ function doAssociations(&$model, $interactive = true) {

$wannaDoMoreAssoc = $this->in(__('Would you like to define some additional model associations?', true), array('y','n'), 'n');

while ((low($wannaDoMoreAssoc) == 'y' || low($wannaDoMoreAssoc) == 'yes')) {
while ((strtolower($wannaDoMoreAssoc) == 'y' || strtolower($wannaDoMoreAssoc) == 'yes')) {
$assocs = array(1 => 'belongsTo', 2 => 'hasOne', 3 => 'hasMany', 4 => 'hasAndBelongsToMany');
$bad = true;
while ($bad) {
Expand Down
4 changes: 2 additions & 2 deletions cake/console/libs/tasks/plugin.php
Expand Up @@ -136,7 +136,7 @@ function bake($plugin) {

$looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');

if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');

$Folder = new Folder($this->path . $pluginPath);
Expand All @@ -146,7 +146,7 @@ function bake($plugin) {
$Folder->create($this->path . $pluginPath . DS . $directory);
}

if (low($verbose) == 'y' || low($verbose) == 'yes') {
if (strtolower($verbose) == 'y' || strtolower($verbose) == 'yes') {
foreach ($Folder->messages() as $message) {
$this->out($message);
}
Expand Down
6 changes: 3 additions & 3 deletions cake/console/libs/tasks/project.php
Expand Up @@ -144,7 +144,7 @@ function bake($path, $skel = null, $skip = array('empty')) {

$looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');

if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');

$Folder = new Folder($skel);
Expand All @@ -157,14 +157,14 @@ function bake($path, $skel = null, $skip = array('empty')) {
return false;
}

if (low($verbose) == 'y' || low($verbose) == 'yes') {
if (strtolower($verbose) == 'y' || strtolower($verbose) == 'yes') {
foreach ($Folder->messages() as $message) {
$this->out($message);
}
}

return true;
} elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
} elseif (strtolower($looksGood) == 'q' || strtolower($looksGood) == 'quit') {
$this->out('Bake Aborted.');
} else {
$this->execute(false);
Expand Down
12 changes: 6 additions & 6 deletions cake/console/libs/tasks/view.php
Expand Up @@ -161,25 +161,25 @@ function __interactive() {

$this->controllerName = $this->Controller->getName();

$this->controllerPath = low(Inflector::underscore($this->controllerName));
$this->controllerPath = strtolower(Inflector::underscore($this->controllerName));

$interactive = $this->in("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite {$this->controllerName} views if it exist.", array('y','n'), 'y');

if (low($interactive) == 'y' || low($interactive) == 'yes') {
if (strtolower($interactive) == 'y' || strtolower($interactive) == 'yes') {
$this->interactive = true;
$wannaDoScaffold = $this->in("Would you like to create some scaffolded views (index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller and model classes (including associated models).", array('y','n'), 'n');
}

if (low($wannaDoScaffold) == 'y' || low($wannaDoScaffold) == 'yes') {
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoScaffold) == 'yes') {
$wannaDoAdmin = $this->in("Would you like to create the views for admin routing?", array('y','n'), 'y');
}
$admin = false;

if ((low($wannaDoAdmin) == 'y' || low($wannaDoAdmin) == 'yes')) {
if ((strtolower($wannaDoAdmin) == 'y' || strtolower($wannaDoAdmin) == 'yes')) {
$admin = $this->getAdmin();
}

if (low($wannaDoScaffold) == 'y' || low($wannaDoScaffold) == 'yes') {
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoScaffold) == 'yes') {
$actions = $this->scaffoldActions;
if ($admin) {
foreach ($actions as $action) {
Expand Down Expand Up @@ -213,7 +213,7 @@ function __interactive() {
$this->out("Path: ".$this->params['app'] . DS . $this->controllerPath . DS . Inflector::underscore($action) . ".ctp");
$this->hr();
$looksGood = $this->in('Look okay?', array('y','n'), 'y');
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
$this->bake($action);
$this->_stop();
} else {
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/model/datasources/dbo/dbo_oracle.php
Expand Up @@ -952,11 +952,11 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!isset($resultSet) || !is_array($resultSet)) {
if (Configure::read() > 0) {
e('<div style = "font: Verdana bold 12px; color: #FF0000">' . sprintf(__('SQL Error in model %s:', true), $model->alias) . ' ');
echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . sprintf(__('SQL Error in model %s:', true), $model->alias) . ' ';
if (isset($this->error) && $this->error != null) {
e($this->error);
echo $this->error;
}
e('</div>');
echo '</div>';
}
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/model/datasources/dbo_source.php
Expand Up @@ -742,11 +742,11 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!isset($resultSet) || !is_array($resultSet)) {
if (Configure::read() > 0) {
e('<div style = "font: Verdana bold 12px; color: #FF0000">' . sprintf(__('SQL Error in model %s:', true), $model->alias) . ' ');
echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . sprintf(__('SQL Error in model %s:', true), $model->alias) . ' ';
if (isset($this->error) && $this->error != null) {
e($this->error);
echo $this->error;
}
e('</div>');
echo '</div>';
}
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/model/model.php
Expand Up @@ -372,7 +372,7 @@ function __construct($id = false, $table = null, $ds = null) {
} elseif ($table) {
$this->useTable = $table;
}

if ($ds !== null) {
$this->useDbConfig = $ds;
}
Expand Down Expand Up @@ -827,7 +827,7 @@ function deconstruct($field, $data) {
$type = $this->getColumnType($field);

if (in_array($type, array('datetime', 'timestamp', 'date', 'time'))) {
$useNewDate = (isset($data['year']) || isset($data['month']) ||
$useNewDate = (isset($data['year']) || isset($data['month']) ||
isset($data['day']) || isset($data['hour']) || isset($data['minute']));

$dateFields = array('Y' => 'year', 'm' => 'month', 'd' => 'day', 'H' => 'hour', 'i' => 'min', 's' => 'sec');
Expand Down Expand Up @@ -1343,7 +1343,7 @@ function __saveMulti($joined, $id) {
unset($values);
} elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
$newData[] = $row;
} elseif (isset($row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
} elseif (isset($row[$join]) && isset($row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
$newData[] = $row[$join];
}
}
Expand Down

0 comments on commit b2c3000

Please sign in to comment.