Changeset 8 in ExiteCMS8


Ignore:
Timestamp:
01/10/11 00:17:02 (17 months ago)
Author:
WanWizard
Message:

merged upstream changes in the fuel core

Location:
trunk/fuel
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/fuel/core/classes/file.php

    r2 r8  
    381381        if ( ! is_file($path)) 
    382382        { 
    383             echo $path.PHP_EOL; 
    384383            throw new \Exception('Cannot delete file: given path "'.$path.'" is not a file.'); 
    385384        } 
  • trunk/fuel/core/classes/request.php

    r2 r8  
    151151                        return $controller->output; 
    152152                    } 
     153 
     154                    \Output::send_headers(); 
    153155                    exit($controller->output); 
    154156                } 
  • trunk/fuel/core/classes/validation.php

    r2 r8  
    419419    { 
    420420        // first try direct match 
    421         if ($val === $compare || ( ! $strict && $val == $compare)) 
     421        if (empty($val) || $val === $compare || ( ! $strict && $val == $compare)) 
    422422        { 
    423423            return true; 
     
    449449    public function _validation_match_pattern($val, $pattern) 
    450450    { 
    451         return preg_match($pattern, $val) > 0; 
     451        return empty($val) || preg_match($pattern, $val) > 0; 
    452452    } 
    453453 
     
    462462    public function _validation_match_field($val, $field) 
    463463    { 
    464         return $this->input($field) === $val; 
     464        return empty($val) || $this->input($field) === $val; 
    465465    } 
    466466 
     
    474474    public function _validation_min_length($val, $length) 
    475475    { 
    476         return (MBSTRING ? mb_strlen($val) : strlen($val)) >= $length; 
     476        return empty($val) || (MBSTRING ? mb_strlen($val) : strlen($val)) >= $length; 
    477477    } 
    478478 
     
    486486    public function _validation_max_length($val, $length) 
    487487    { 
    488         return (MBSTRING ? mb_strlen($val) : strlen($val)) <= $length; 
     488        return empty($val) || (MBSTRING ? mb_strlen($val) : strlen($val)) <= $length; 
    489489    } 
    490490 
     
    498498    public function _validation_exact_length($val, $length) 
    499499    { 
    500         return (MBSTRING ? mb_strlen($val) : strlen($val)) == $length; 
     500        return empty($val) || (MBSTRING ? mb_strlen($val) : strlen($val)) == $length; 
    501501    } 
    502502 
     
    568568    public function _validation_valid_string($val, $flags = array('alpha', 'utf8')) 
    569569    { 
     570        if (empty($val)) 
     571        { 
     572            return true; 
     573        } 
     574 
    570575        if ( ! is_array($flags)) 
    571576        { 
     
    600605        } 
    601606 
    602         $pattern  = '/^(['; 
    603         $pattern .= ! in_array('uppercase', $flags) && in_array('alpha', $flags) ? 'a-z' : ''; 
     607        $pattern = ! in_array('uppercase', $flags) && in_array('alpha', $flags) ? 'a-z' : ''; 
    604608        $pattern .= ! in_array('lowercase', $flags) && in_array('alpha', $flags) ? 'A-Z' : ''; 
    605609        $pattern .= in_array('numeric', $flags) ? '0-9' : ''; 
     
    610614        $pattern .= in_array('punctuation', $flags) ? "\.,\!\?:;" : ''; 
    611615        $pattern .= in_array('dashes', $flags) ? '_\-' : ''; 
    612         $pattern .= '])+$/'; 
     616        $pattern = empty($pattern) ? '/^(.*)$/' : ('/^(['.$pattern.'])+$/'); 
    613617        $pattern .= in_array('utf8', $flags) ? 'u' : ''; 
    614618 
     
    625629    public function _validation_numeric_min($val, $min_val) 
    626630    { 
    627         return floatval($val) >= floatval($min_val); 
     631        return empty($val) || floatval($val) >= floatval($min_val); 
    628632    } 
    629633 
     
    637641    public function _validation_numeric_max($val, $max_val) 
    638642    { 
    639         return floatval($val) <= floatval($max_val); 
     643        return empty($val) || floatval($val) <= floatval($max_val); 
    640644    } 
    641645} 
  • trunk/fuel/packages/activerecord/classes/model.php

    r6 r8  
    410410            $this->associations[$assoc_name]->set_ids($value, $this); 
    411411        } 
     412        else 
     413        { 
     414            throw new \Exception("attribute called '$name' doesn't exist", Exception::AttributeNotFound); 
     415        } 
    412416    } 
    413417 
     
    667671            foreach ($this->columns as $column) 
    668672            { 
    669                 if ($column == $this->primary_key OR ! in_array($column, $this->columns)) 
     673                if ($column == $this->primary_key) 
    670674                { 
    671675                    continue; 
  • trunk/fuel/packages/oil/classes/generate.php

    r6 r8  
    7676        if (self::write($filepath, $controller)) 
    7777        { 
    78             \Cli::write('Created controller: ' . $filepath); 
     78            \Cli::write("\t".'Created controller: ' . \Fuel::clean_path($filepath)); 
    7979        } 
    8080    } 
     
    106106        if (self::write($filepath, $model)) 
    107107        { 
    108             \Cli::write('Created model: ' . \Fuel::clean_path($filepath)); 
     108            \Cli::write("\t".'Created model: ' . \Fuel::clean_path($filepath)); 
    109109        } 
    110110 
     
    151151            if (self::write($view_file, $view)) 
    152152            { 
    153                 \Cli::write("\tCreated view: " . $view_file); 
     153                \Cli::write("\t".'Created view: ' . \Fuel::clean_path($view_file)); 
    154154            } 
    155155        } 
  • trunk/fuel/packages/oil/classes/package.php

    r6 r8  
    9898        } 
    9999 
    100         \Cli::write('Uninstalling package "' . $package . '"', 'yellow'); 
     100        \Cli::write('Package "' . $package . '" was uninstalled.', 'yellow'); 
    101101 
    102102        \File::delete_dir($package_folder); 
  • trunk/fuel/packages/oil/views/scaffold/actions/create.php

    r6 r8  
    11        if ($_POST) 
    22        { 
    3             $<?php echo $singular; ?> = <?php echo $model; ?>::factory($_POST); 
     3            $<?php echo $singular; ?> = <?php echo $model; ?>::factory(array( 
     4<?php foreach ($fields as $field): ?> 
     5                '<?php echo $field['name']; ?>' => Input::post('<?php echo $field['name']; ?>'), 
     6<?php endforeach; ?> 
     7            )); 
    48 
    59            if ($<?php echo $singular; ?> and $<?php echo $singular; ?>->save()) 
    610            { 
    7                 Session::set_flash('notice', 'Added ' . $<?php echo $singular; ?> . ' #' . $<?php echo $singular; ?>->id); 
     11                Session::set_flash('notice', 'Added ' . $<?php echo $singular; ?> . ' #' . $<?php echo $singular; ?>->id . '.'); 
    812 
    913                Output::redirect('<?php echo $plural; ?>'); 
     
    1216            else 
    1317            { 
    14                 Session::set_flash('notice', 'Could not save ' . $<?php echo $singular; ?> . ' #' . $id); 
     18                Session::set_flash('notice', 'Could not save <?php echo $singular; ?>.'); 
    1519            } 
    16  
    1720        } 
    1821 
  • trunk/fuel/packages/oil/views/scaffold/actions/edit.php

    r6 r8  
    33        if ($_POST) 
    44        { 
    5             if ($<?php echo $singular; ?>->update($_POST)) 
     5<?php foreach ($fields as $field): ?> 
     6            $<?php echo $singular; ?>-><?php echo $field['name']; ?> = Input::post('<?php echo $field['name']; ?>'); 
     7<?php endforeach; ?> 
     8 
     9            if ($<?php echo $singular; ?>->save()) 
    610            { 
    711                Session::set_flash('notice', 'Updated ' . $<?php echo $singular; ?> . ' #' . $<?php echo $singular; ?>->id); 
Note: See TracChangeset for help on using the changeset viewer.