Browse Source

Merging fixes and enhancements into trunk.

Revision: [2457]
Adding fix for Ticket #612

Revision: [2456]
"Enables use of Controller::$data in addition to Controller::$params['data']"

Revision: [2455]
"Adding fix for Ticket #634"

Revision: [2454]
"Removing trailing directory separator on ROOT"

Revision: [2451]
Dispatching and routing changes for IIS

Revision: [2450]
Downgrading error level in AclNode::create and adding additional filename check in listClasses()


git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2462 3807eeeb-6ff5-0310-8944-8be069107fe0
phpnut 20 years ago
parent
commit
43e074acb0

+ 1 - 1
VERSION.txt

@@ -6,4 +6,4 @@
 // +---------------------------------------------------------------------------------------------------+ //
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-1.0.0.2449
+1.0.0.2462

+ 3 - 3
app/config/inflections.php

@@ -62,13 +62,13 @@ $singularRules = array();
  * You should not have to change this value below if you do change it use same format
  * as the $uninflectedPlural above.
  */
-$uninflectedSingluar = $uninflectedPlural;
+$uninflectedSingular = $uninflectedPlural;
 /**
  * This is a key => value array of singular irregular words.
  * Most of the time this will be a reverse of the above $irregularPlural array
  * You should not have to change this value below if you do change it use same format
  *
- * $irregularSingluar = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
+ * $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
  */
-$irregularSingluar = array_flip($irregularPlural);
+$irregularSingular = array_flip($irregularPlural);
 ?>

+ 9 - 2
cake/basics.php

@@ -350,7 +350,7 @@ function listClasses($path)
     $classes = array();
     while (false !== ($file = readdir($dir)))
     {
-        if ((substr($file, -3, 3) == 'php'))
+        if ((substr($file, -3, 3) == 'php') && substr($file, 0, 1) != '.')
         {
             $classes[] = $file;
         }
@@ -753,7 +753,14 @@ function setUri()
         if (env('argv'))
         {
             $uri = env('argv');
-            $uri = env('PHP_SELF') .'/'. $uri[0];
+            if (defined('SERVER_IIS'))
+            {
+                $uri = BASE_URL.$uri[0];
+            }
+            else
+            {
+                $uri = env('PHP_SELF') .'/'. $uri[0];
+            }
         }
         else
         {

+ 9 - 1
cake/bootstrap.php

@@ -59,7 +59,15 @@ if (empty($uri) && defined('BASE_URL'))
     }
     else
     {
-        $elements = explode('/index.php', $uri);
+        if (strpos($uri, 'index.php') !== false)
+        {
+            $uri = r ('?', '', $uri);
+        	$elements = explode('/index.php', $uri);
+        }
+        else
+        {
+            $elements = explode('/?', $uri);
+        }
         if(!empty($elements[1]))
         {
             $_GET['url'] = $elements[1];

+ 1 - 0
cake/dispatcher.php

@@ -405,6 +405,7 @@ class Dispatcher extends Object
                 return $base;
             }
         }
+        return $base;
     }
 
     function _restructureParams($params)

+ 2 - 1
cake/libs/controller/components/dbacl/models/aclnode.php

@@ -89,7 +89,8 @@ class AclNode extends AppModel
          $parent = $this->find($this->_resolveID($parent_id));
          if($parent == null || count($parent) == 0)
          {
-            trigger_error("Null parent in {$class}::create()", E_USER_ERROR);
+            trigger_error("Null parent in {$class}::create()", E_USER_WARNING);
+            return null;
          }
 
          $parent = $parent[$class];

+ 8 - 1
cake/libs/controller/controller.php

@@ -419,7 +419,14 @@ class Controller extends Object
                 header($codes[$status]);
             }
         }
-        header ('Location: '.$url);
+        if (defined('SERVER_IIS'))
+        {
+            header ('Location: '.FULL_BASE_URL . $url);
+        }
+        else
+        {
+            header ('Location: '.$url);
+        }
     }
 
 /**

+ 2 - 2
cake/libs/inflector.php

@@ -248,8 +248,8 @@ class Inflector extends Object
         {
             include(CONFIGS.'inflections.php');
             $singularRules = array_merge($singularRules, $coreSingularRules);
-            $uninflected = array_merge($uninflectedSingluar, $coreUninflectedSingular);
-            $irregular = array_merge($irregularSingluar, $coreIrregularSingular);
+            $uninflected = array_merge($uninflectedSingular, $coreUninflectedSingular);
+            $irregular = array_merge($irregularSingular, $coreIrregularSingular);
         }
 
         $regexUninflected = __enclose(join( '|', $uninflected));

+ 1 - 1
cake/libs/model/datasources/dbo_source.php

@@ -388,7 +388,7 @@ class DboSource extends DataSource
             $count++;
         }
 
-        if($this->execute('INSERT INTO '.$model->table.' ('.join(',', $fieldInsert).') VALUES ('.join(',', $valueInsert).')'))
+        if($this->execute('INSERT INTO '.$this->name($model->table).' ('.join(',', $fieldInsert).') VALUES ('.join(',', $valueInsert).')'))
         {
             return true;
         }

+ 4 - 1
cake/libs/router.php

@@ -118,7 +118,10 @@ class Router extends Object {
 // Here's the fix.
       if ($url && ('/' != $url[0]))
       {
-         $url = '/'.$url;
+         if (!defined('SERVER_IIS'))
+         {
+             $url = '/'.$url;
+         }
       }
 
       $out = array();

+ 22 - 12
cake/libs/view/helpers/html.php

@@ -329,25 +329,25 @@ function url($url = null, $return = false)
     function checkbox($fieldName, $title = null, $htmlAttributes = null, $return = false)
     {
         $value = $this->tagValue($fieldName);
-        $model = new $this->model;
-        $db =& ConnectionManager::getDataSource($model->useDbConfig);
-        $value = $db->boolean($value);
+        $notCheckedValue = 0;
 
-        if($value === true || $value === 't')
+        if (isset($htmlAttributes['value']))
         {
-            $htmlAttributes['checked'] = 'checked';
+        	$htmlAttributes['checked'] = ($htmlAttributes['value'] == $value)? 'checked': null;
+        	if ($htmlAttributes['checked'] == '0') {
+        		$notCheckedValue = -1;
+        	}
         }
         else
         {
-            $htmlAttributes['checked'] = null;
-        }
-
-        if(!isset($htmlAttributes['value']))
-        {
+            $model = new $this->model;
+            $db =& ConnectionManager::getDataSource($model->useDbConfig);
+            $value = $db->boolean($value);
+        	$htmlAttributes['checked'] = $value? 'checked': null;
             $htmlAttributes['value'] = 1;
         }
 
-        $output = $this->hidden($fieldName, array('value' => 0), true);
+        $output = $this->hidden($fieldName, array('value' => $notCheckedValue), true);
         $output .= sprintf($this->tags['checkbox'], $this->model, $this->field,
                 $this->_parseAttributes($htmlAttributes, null, '', ' '));
         return $output;
@@ -601,7 +601,17 @@ function url($url = null, $return = false)
     function tagValue ($fieldName)
     {
         $this->setFormTag($fieldName);
-        return isset($this->params['data'][$this->model][$this->field])? htmlspecialchars($this->params['data'][$this->model][$this->field]): null;
+
+        if(isset($this->params['data'][$this->model][$this->field]))
+        {
+            return h($this->params['data'][$this->model][$this->field]);
+        }
+        elseif(isset($this->data[$this->model][$this->field]))
+        {
+            return h($this->data[$this->model][$this->field]);
+        }
+
+        return false;
     }
 
 /**

+ 1 - 1
index.php

@@ -34,7 +34,7 @@
  */
 define ('APP_DIR', 'app');
 define ('DS', DIRECTORY_SEPARATOR);
-define ('ROOT', dirname(__FILE__).DS);
+define ('ROOT', dirname(__FILE__));
 define ('WEBROOT_DIR', 'webroot');
 
 define('WWW_ROOT', ROOT.APP_DIR.DS.WEBROOT_DIR.DS);