diff --git a/app/webroot/css.php b/app/webroot/css.php index 55b2c9a42..45391b754 100644 --- a/app/webroot/css.php +++ b/app/webroot/css.php @@ -111,7 +111,7 @@ else header("Date: ".date("D, j M Y G:i:s ", $templateModified).'GMT'); header("Content-Type: text/css"); -header("Expires: ".date("D, j M Y G:i:s T", time()+DAY)); +header("Expires: ".gmdate("D, j M Y H:i:s", time()+DAY)." GMT"); header("Cache-Control: cache"); // HTTP/1.1 header("Pragma: cache"); // HTTP/1.0 print $output; diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index fdb7dd113..53cd2b908 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -618,7 +618,7 @@ class Controller extends Object // Now, set up some other attributes that will be useful for auto generating a form. //tagName is in the format table/field "post/title" - $fieldNames[ $tabl['name']]['tagName'] = $modelKey.'/'.$tabl['name']; + $fieldNames[ $tabl['name']]['tagName'] = $model.'/'.$tabl['name']; // Now, find out if this is a required field. //$validationFields = $classRegistry->getObject($table)->validate; @@ -651,6 +651,7 @@ class Controller extends Object { case "text": + case "mediumtext": { $fieldNames[ $tabl['name']]['type'] = 'area'; //$fieldNames[ $tabl['name']]['size'] = $fieldLength; @@ -666,7 +667,9 @@ class Controller extends Object // get the list of options from the other model. $registry = ClassRegistry::getInstance(); - $otherModel = $registry->getObject($fieldNames[$tabl['name']]['model']); + $otherModel = $registry->getObject(Inflector::underscore($fieldNames[$tabl['name']]['model'])); + + if( is_object($otherModel) ) { if( $doCreateOptions ) @@ -746,7 +749,7 @@ class Controller extends Object } } } - $fieldNames[ $tabl['name']]['selected'] = $data[$modelKey][$tabl['name']]; + $fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']]; } } else @@ -768,7 +771,7 @@ class Controller extends Object $enum = trim( $enum, "'" ); $fieldNames[$tabl['name']]['options'][$enum] = $enum; } - $fieldNames[ $tabl['name']]['selected'] = $data[$table][$tabl['name']]; + $fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']]; } break; @@ -807,15 +810,15 @@ class Controller extends Object { foreach( $pass as $key=>$value ) { - if( $key == $modelKey && isset( $value['id'] ) && isset( $value[$otherDisplayField] ) ) + if( $key == $modelName && isset( $value['id'] ) && isset( $value[$otherDisplayField] ) ) { $fieldNames[$modelKey]['options'][$value['id']] = $value[$otherDisplayField]; } } } - if( isset( $data[$modelKey] ) ) + if( isset( $data[$model] ) ) { - foreach( $data[$modelKey] as $row ) + foreach( $data[$model] as $row ) { $fieldNames[$modelKey]['selected'][$row['id']] = $row['id']; } @@ -823,6 +826,7 @@ class Controller extends Object } } // end loop through manytomany relations. } + return $fieldNames; } } diff --git a/cake/libs/controller/templates/scaffolds/edit.thtml b/cake/libs/controller/templates/scaffolds/edit.thtml index 12f904372..149d3eb4d 100644 --- a/cake/libs/controller/templates/scaffolds/edit.thtml +++ b/cake/libs/controller/templates/scaffolds/edit.thtml @@ -30,12 +30,12 @@ */ $modelName = Inflector::singularize($this->name); - $modelKey = Inflector::underscore($modelName); + $modelKey = $modelName; ?>

Edit

formTag('/'.Inflector::underscore($this->name).'/update'); + echo $html->formTag('/'. $this->name .'/update'); echo $form->generateFields( $fieldNames ); diff --git a/cake/libs/controller/templates/scaffolds/list.thtml b/cake/libs/controller/templates/scaffolds/list.thtml index 01934eaf9..49cdeb8d1 100644 --- a/cake/libs/controller/templates/scaffolds/list.thtml +++ b/cake/libs/controller/templates/scaffolds/list.thtml @@ -33,7 +33,7 @@ name); - $modelKey = Inflector::underscore(Inflector::singularize($this->name)); + $modelKey = $model; $humanName = Inflector::humanize($this->name); $humanSingularName = Inflector::singularize( $humanName ); // var_dump( $data ); @@ -70,9 +70,9 @@ $otherModelObject = $registry->getObject( $otherModelKey ); if( is_object($otherModelObject) ) { - $displayText = $row[$otherModelKey][ $otherModelObject->getDisplayField() ]; + $displayText = $row[$value['model']][ $otherModelObject->getDisplayField() ]; } else{ - $displayText = $row[$otherModelKey][$field]; + $displayText = $row[$value['model']][$field]; } echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] ); diff --git a/cake/libs/controller/templates/scaffolds/new.thtml b/cake/libs/controller/templates/scaffolds/new.thtml index e4f756b48..15615fad4 100644 --- a/cake/libs/controller/templates/scaffolds/new.thtml +++ b/cake/libs/controller/templates/scaffolds/new.thtml @@ -32,7 +32,7 @@

New name)?>

formTag('/'.Inflector::underscore($this->name).'/create'); + echo $html->formTag('/'. $this->name .'/create'); echo $form->generateFields( $fieldNames ); diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index 5b771be2a..ab3bdac57 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -514,7 +514,7 @@ class Model extends Object $this->{$className}->{$this->currentModel.'_insertsql'} = null; break; } - $this->tableToModel[$this->{$className}->table] = strtolower($className); + $this->tableToModel[$this->{$className}->table] = $className; } /** @@ -561,7 +561,7 @@ class Model extends Object else { $this->table = $tableName; - $this->tableToModel[$this->table] = Inflector::underscore($this->name); + $this->tableToModel[$this->table] = $this->name; $this->loadInfo(); } } diff --git a/cake/libs/validators.php b/cake/libs/validators.php index 39a810d8d..9521b46b9 100644 --- a/cake/libs/validators.php +++ b/cake/libs/validators.php @@ -44,7 +44,7 @@ define('VALID_NUMBER', '/^[0-9]+$/'); /** * A valid email address. */ -define('VALID_EMAIL', '/^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.[a-z]{2,3})$/i'); +define('VALID_EMAIL', '/^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.([a-z][a-z]|com|org|net|biz|info|name|net|pro|aero|coop|museum))$/i'); /** * A valid year (1000-2999). diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index ae97d1b11..00a6b9430 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -160,10 +160,12 @@ class HtmlHelper extends Helper } elseif ($url{0} == '/') { + $url = Inflector::underscore($url); $output = $this->base . $url; } else { + $url = Inflector::underscore($url); $output = $this->base.'/'.strtolower($this->params['controller']).'/'.$url; } @@ -1105,7 +1107,7 @@ class HtmlHelper extends Helper */ function formTag($target=null, $type='post', $htmlAttributes=null) { - $htmlAttributes['action'] = $this->UrlFor($target); + $htmlAttributes['action'] = $this->UrlFor($target); $htmlAttributes['method'] = $type=='get'? 'get': 'post'; $type == 'file'? $htmlAttributes['enctype'] = 'multipart/form-data': null; diff --git a/cake/libs/view/templates/layouts/default.thtml b/cake/libs/view/templates/layouts/default.thtml index 48f01623c..cf7d39356 100644 --- a/cake/libs/view/templates/layouts/default.thtml +++ b/cake/libs/view/templates/layouts/default.thtml @@ -1,4 +1,3 @@ -webroot?> diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 88f4c07e9..79341a85c 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -271,13 +271,14 @@ class View extends Object // check for controller-level view handler foreach(array($this->name, 'errors') as $viewDir) { - if(file_exists(VIEWS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml')) + $errorAction =Inflector::underscore($errorAction); + if(file_exists(VIEWS.$viewDir.DS.$errorAction.'.thtml')) { - $missingViewFileName = VIEWS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml'; + $missingViewFileName = VIEWS.$viewDir.DS.$errorAction.'.thtml'; } - elseif(file_exists(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml')) + elseif(file_exists(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml')) { - $missingViewFileName = LIBS.'view'.DS.'templates'.DS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml'; + $missingViewFileName = LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml'; } else {