Merging fixes into 1.x.x.x branched code:

Revision: [2802]




git-svn-id: https://svn.cakephp.org/repo/branches/1.x.x.x@2805 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-05-09 02:15:47 +00:00
parent f5a4a58758
commit 5e268e0805
57 changed files with 3676 additions and 1788 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
1.0.1.2767
1.1.2.2802

View file

@ -0,0 +1,264 @@
*{
margin:0;
padding:0;
}
body{
font-family:verdana,helvetica,arial,sans-serif;
font-size:12px;
text-align:center;
color:#fff;
background:#003d4c;
}
/*
* General Style Info
*/
a{
color:#003d4c;
text-decoration:none;
}
a:hover{
color:#003d4c;
text-decoration:underline;
}
a img{
border:none;
}
h1, h2,h3{
font-family:'Gill Sans';
font-size:28px;
font-weight:normal;
}
h1{
padding:0.5em 0;
color:#003d4c;
}
em {
font-size: 12px;
}
h2{
padding-top:0.15em;
margin:0.3em 0;
color:#e32;
}
h3{
font-size:18px;
padding-top:0.5em;
color:#003d4c;
}
h4{
color:#ff9966;
font-size:20px;
padding-top:0.5em;
font-weight:normal;
}
blockquote{
padding: 10px;
padding-left: 20px;
padding-right: 20px;
}
#content ol, #content ul{
margin:0 1em;
padding:0 2em;
}
/*
* Layout
*/
#container{
text-align:left;
margin-left:0px;
}
#header{
height:200px;
background:#003d4c;
}
#header h1{
color:#fff;
font-family: 'Gill Sans';
font-size: 45px;
font-weight:normal;
}
#header h1.logo {
float:left;
}
#header h1.logo a{
display:block;
width:226px;
height:176px;
background: transparent url('images/logo.gif') no-repeat top;
}
#header h1.logo a:hover{
background:url('images/logo.gif') no-repeat bottom;
}
#content{
width: auto;
min-width: 860px;
min-height: 720px;
padding:15px 20px 50px 20px;
margin: 0px 10px 0px 40px;
color:#333;
background:#fff ;
border-right: 6px solid #222;
}
/*
* Navigation
*/
#navigation{
float:left;
height: 146px;
width:710px;
background:#003d4c url(images/nav_bg.gif) no-repeat;
padding-left: 20px;
}
#navigation ul{
}
#navigation ul li{
list-style-type:none;
display:inline;
}
#navigation ul li a{
font-weight:bold;
display:block;
float:left;
color:#000;
}
#navigation ul li a span{
display:block;
margin-right:12px;
padding:10px 6px 9px 9px;
}
#navigation ul li.active a span{
padding:10px 6px 9px 9px;
}
#navigation ul li a:hover, #navigation ul li.active a{
background:url(images/nav_item_bg.gif) no-repeat bottom right;
}
#navigation ul li a:hover span, #navigation ul li.active a span{
background:url(images/nav_item_bg.gif) no-repeat bottom left;
}
#footer {
color: #fff;
background-color: #003d4c;
padding: 4px 10px;
text-align: right;
}
#footer a{
color: #fff;
}
.left {
float:left;
}
.right {
float:right;
}
.clear {
clear:both;
height: 0px;
line-height: 0px;
}
/* tables */
table {
width: 100%;
border: 1px solid #003d4c;
color:#333;
background-color: #fff;
clear:both;
padding: 0;
margin: 0 0 2em 0;
white-space: normal;
}
th {
background-color: #ccc;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
border-right: 1px solid #003d4c;
border-bottom: 1px solid #003d4c;
text-align: center;
padding:1px;
}
table tr td {
border-right: 1px solid #ccc;
padding:4px 4px;
vertical-align:top;
text-align: center;
}
table tr.altRow td {
background: #f4f4f4;
}
/* scaffold show */
div.related {
clear:both;
display:block;
}
dl {
line-height:2em;
margin:1em;
float:left;
width: 400px;
}
dt {
font-weight: bold;
vertical-align:top;
}
dd {
margin-left:10em;
margin-top:-2em;
vertical-align:top;
}
/* scaffold buttons */
.notice {
color: #DB8101;
background-color: #ddd;
display: block;
padding: 1em;
}
.tip {
color: #DB8101;
background-color: #ddd;
display: block;
padding: 1em;
}
/* action links */
ul.actions {
float:left;
margin-left: 10px;
width: 200px;
}

View file

@ -1,195 +0,0 @@
/* CSS Document */
@import url("cake.forms.css");
* {
padding:0;
margin:0;
}
body {
font: 76% Verdana, Arial, Sans-serif;
color: #333;
}
img {
border:0;
}
#wrapper {
text-align:left;
}
#header {
height: 101px;
background: #0D5087 url(../img/cake.header_bg.png) repeat-x left top;
border-bottom: 1px solid #000;
}
#content {
min-height:400px;
background-color: #fff;
padding:2em 4em;
}
#footer {
text-align:center;
padding:1em 0;
font-size:smaller;
border-top:1px solid #333;
background-color: #063260;
color:#fff;
line-height:1.5;
}
#footer a {
color:#fff;
}
h1, h2, h3, h4 {
padding-bottom:0.5em;
}
h1 {
font-family:"Trebuchet MS",Verdana,Arial,Sans-serif;
}
h1, a {
color:#DB8101;
}
h1 em, a em {
color:#008BCC;
font-style: normal;
}
ul.colored a em
h2 {
font-style: italic;
font-weight: bold;
color:#666;
}
a:hover, a:hover em {
color:#A22424;
text-decoration:none;
}
#content p, #content ul, #content ol {
line-height:1.5;
padding-bottom:1em;
}
ul, ol {
margin-left:3em;
}
/* tables */
table {
width: 100%;
background-color: #fff;
border: 1px solid #333;
clear:both;
margin: 0 0 2em 0;
white-space: normal;
}
th {
background-color: #ccc;
border-top: 1px solid #fff;
border-right: 1px solid #666;
border-bottom: 1px solid #666;
text-align: center;
padding:3px;
}
table tr td {
border-right: 1px solid #ccc;
padding:4px 4px;
vertical-align:top;
text-align: center;
}
table tr.altRow td {
background: #f4f4f4;
}
/* scaffold show */
div.related {
clear:both;
display:block;
}
dl {
line-height:2em;
margin:1em;
}
dt {
font-weight: bold;
vertical-align:top;
}
dd {
margin-left:10em;
margin-top:-2em;
vertical-align:top;
}
/* scaffold buttons */
.notice {
color: #DB8101;
background-color: #ddd;
display: block;
padding: 1em;
}
.tip {
color: #DB8101;
background-color: #ddd;
display: block;
padding: 1em;
}
ul.actions {
list-style: none;
text-align:left;
margin:2em 0;
padding: 0;
}
ul.actions li {
margin-left:1em;
list-style: none;
display: inline;
}
ul.actions li a, ul.actions li input {
padding: 2px 12px;
color: #DB8101;
background-color:#ccc;
text-decoration: none;
border: 1px solid #666;
line-height: 24px;
font-weight: bold;
text-align:center;
text-decoration: none;
}
ul.actions li a:hover {
color: #DB8101;
background-color:#fff;
text-decoration: none;
}
td.listactions {
width: 14em;
text-align: center;
white-space: nowrap;
}
td.listactions a {
padding: 0px 8px;
text-align:center;
font-weight: bold;
color: #DB8101;
background-color:#ccc;
text-decoration: none;
border: 1px solid #666;
white-space: nowrap;
}
td.listactions a:hover {
color: #fff;
background-color:#DB8101;
}
/* index links */
ul.colored a {
}
ul.colored a em {
}
a {
font-weight: bold;
}

View file

@ -1,9 +0,0 @@
form div,
form div label.labelCheckbox, form div label.labelRadio,
form div small,
form div label.labelCheckbox, form div label.labelRadio, label.labelCheckbox, label.labelRadio {
height: expression('1%');
}
form div fieldset input.inputText, form div fieldset input.inputPassword, form div fieldset input.inputFile, form div fieldset textarea.inputTextarea {
margin: expression('0px 0px 0px -124px');
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

BIN
app/webroot/css/images/logo.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
app/webroot/css/images/nav_bg.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1141,4 +1141,51 @@ function convertSlash($string)
return $string;
}
/**
* chmod recursively on a directory
*
* @param string $path
* @param int $mode
* @return boolean
*/
function chmodr($path, $mode = 0755)
{
if (!is_dir($path))
{
return chmod($path, $mode);
}
$dir = opendir($path);
while ($file = readdir($dir))
{
if($file != '.' && $file != '..')
{
$fullpath = $path.'/'.$file;
if(!is_dir($fullpath))
{
if (!chmod($fullpath, $mode))
{
return false;
}
}
else
{
if (!chmodr($fullpath, $mode))
{
return false;
}
}
}
}
closedir($dir);
if(chmod($path, $mode))
{
return true;
}
else
{
return false;
}
}
?>

View file

@ -410,8 +410,9 @@ class Dispatcher extends Object
$docRoot = env('DOCUMENT_ROOT');
$scriptName = env('PHP_SELF');
$r = null;
$appDirName = str_replace('/','\/',preg_quote(APP_DIR));
if (preg_match('/'.APP_DIR.'\\'.DS.WEBROOT_DIR.'/', $docRoot))
if (preg_match('/'.$appDirName.'\\'.DS.WEBROOT_DIR.'/', $docRoot))
{
$this->webroot = '/';
if (preg_match('/^(.*)\/index\.php$/', $scriptName, $r))
@ -429,7 +430,7 @@ class Dispatcher extends Object
$webroot = setUri();
$htaccess = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.'/'.WEBROOT_DIR.'/';
}
if (preg_match('/^(.*)\\/'.APP_DIR.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs))
if (preg_match('/^(.*)\\/'.$appDirName.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs))
{
if(APP_DIR === 'app')
{

View file

@ -265,20 +265,25 @@ class DB_ACL extends AclBase
trigger_error('Null id provided in DB_ACL::get'.$object, E_USER_WARNING);
return null;
}
$obj = new $obj;
$obj = new $object;
if (is_numeric($id))
{
$conditions = array('Aco.user_id' => $id);
$key = 'user_id';
if ($object == 'Aco')
{
$key = 'object_id';
}
$conditions = array($object.'.'.$key => $id);
}
else
{
$conditions = array('Aco.alias' => $id);
$conditions = array($object.'.alias' => $id);
}
$tmp = $obj->find($conditions);
$aco->setId($tmp['Aco']['id']);
return $aco;
$obj->id = $tmp[$object]['id'];
return $obj;
}
/**

View file

@ -65,10 +65,10 @@ class AclNode extends AppModel
if($parent_id == null || $parent_id === 0)
{
$parent = $this->find(null, "MAX(rght)", null, null, 0);
$parent['lft'] = $parent[0]['MAX(rght)'];
$parent = $this->find(null, 'MAX(rght) as rght', null, -1);
$parent['lft'] = $parent[0]['rght'];
if($parent[0]['MAX(rght)'] == null)
if($parent[0]['rght'] == null || !$parent[0]['rght'])
{
// The tree is empty
$parent['lft'] = 0;
@ -141,7 +141,7 @@ class AclNode extends AppModel
if($parent_id == null)
{
$newParent = $this->find(null, "MAX(rght) as lft", null, 0);
$newParent = $this->find(null, 'MAX(rght) as lft', null, -1);
$newParent = $newParent[0];
$newParent['rght'] = $newParent['lft'];
}

View file

@ -944,6 +944,7 @@ class Controller extends Object
unset($this->params['data'][$this->modelClass][$field['name'].'_min']);
unset($this->params['data'][$this->modelClass][$field['name'].'_meridian']);
$this->params['data'][$this->modelClass][$field['name']] = $newDate;
$this->data[$this->modelClass][$field['name']] = $newDate;
}
else if( 'datetime' == $field['type'] && isset($this->params['data'][$this->modelClass][$field['name'].'_year'] ) )
{
@ -963,6 +964,7 @@ class Controller extends Object
unset($this->params['data'][$this->modelClass][$field['name'].'_min']);
unset($this->params['data'][$this->modelClass][$field['name'].'_meridian']);
$this->params['data'][$this->modelClass][$field['name']] = $newDate;
$this->data[$this->modelClass][$field['name']] = $newDate;
}
}
}

View file

@ -68,7 +68,7 @@ class AjaxHelper extends Helper
*
* @var array
*/
var $dragOptions = array('handle', 'revert', 'constraint', 'change');
var $dragOptions = array('handle', 'revert', 'constraint', 'change', 'ghosting');
/**
* Options for droppable.

View file

@ -28,50 +28,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CakePHP : A Rapid Development Framework :: <?php echo $title_for_layout?></title>
<title>CakePHP : The PHP Rapid Development Framework :: <?php echo $title_for_layout?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<?php echo $html->charset('UTF-8')?>
<?php echo $html->css('cake.default')?>
<!--[if lt IE 7]>
<?php echo $html->css('cake.ie');?>
<![endif]-->
<?php echo $html->css('cake.basic', 'stylesheet', array("media"=>"all" ));?>
<?php echo $html->css('cake.forms', 'stylesheet', array("media"=>"all" ));?>
</head>
<body>
<div id="wrapper">
<body class="main">
<div id="container">
<div id="header">
<?php echo $html->image('cake.logo.png', array('alt'=>'CakePHP : Rapid Development Framework', 'border'=>"0"))?>
</div>
<h1 class="logo">
<a href="http://cakephp.org"></a>
</h1>
<div id="navigation">
<ul>
<li class="active"><a href="http://cakephp.org"><span>Home</span></a></li>
<li><a href="http://cakephp.org/downloads/"><span>Downloads</span></a></li>
<!--<li><a href="#"><span>Screencasts coming soon!</span></a></li>-->
<li><a href="http://manual.cakephp.org"><span>Manual</span></a></li>
<li><a href="http://api.cakephp.org/"><span>API</span></a></li>
<li><a href="http://bakery.cakephp.org"><span>Bakery</span></a></li>
<li><a href="https://trac.cakephp.org"><span>Trac</span></a></li>
<li><a href="http://cakeforge.org"><span>CakeForge</span></a></li>
</ul>
</div> <!-- #navigation -->
</div> <!-- #header -->
<div id="content">
<?php if (isset($this->controller->Session)) $this->controller->Session->flash(); ?>
<?php if ($this->controller->Session->check('Message.flash')) $this->controller->Session->flash(); ?>
<?php echo $content_for_layout?>
<div class="clear"></div>
</div> <!-- #content -->
<div id="footer">
<p>
CakePHP : <a href="http://www.cakefoundation.org/pages/copyright/">&copy; 2006 Cake Software Foundation, Inc.</a>
</p>
<a href="http://www.w3c.org/" target="_new">
<?php echo $html->image('w3c_css.png', array('alt'=>"valid css", 'border'=>"0"))?>
</a>
<a href="http://www.w3c.org/" target="_new">
<?php echo $html->image('w3c_xhtml10.png', array('alt'=>"valid xhtml", 'border'=>"0"))?>
</a>
<a href="http://www.cakephp.org/" target="_new">
<?php echo $html->image('cake.power.png', array('alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"))?>
</a>
</div>
<?php echo $cakeDebug;?>
<div id="footer">
<p>CakePHP ::
<a href="http://www.cakefoundation.org/pages/copyright/">&copy; 2006 Cake Software Foundation, Inc.</a>
</p>
<br />
<p>
<!--PLEASE USE ONE OF THE POWERED BY CAKEPHP LOGO-->
<a href="http://www.cakephp.org/" target="_blank">
<?php echo $html->image('cake.power.png', array('alt'=>'CakePHP : Rapid Development Framework',
'height' => "15",
'width' => "80"))?>
</a>
</p>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<?php echo $html->image('w3c_xhtml10.png', array('alt' => 'Valid XHTML 1.0 Transitional',
'height' => "15",
'width' => "80"))?>
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<?php echo $html->image('w3c_css.png', array('alt' => 'Valid CSS!',
'height' => "15",
'width' => "80"))?>
</a>
</p>
</div>
</div>
</div> <!-- #container -->
</body>
</html>

View file

@ -35,18 +35,18 @@
<p style="background:#DBA941;padding:4px;font-size: 16px;">Cake<?php echo $connected->isConnected() ? ' is able to' : ' is not able to';?> connect to the database.</p>
<br />
<?php endif; ?>
<h1>Cake<em>PHP</em></h1>
<h1>CakePHP</h1>
<p>If you plan to upgrade from an older version, you may also want to read the <a href="http://cakephp.org/pages/changelog">changelog</a></p>
<h2>Editing <em>this Page</em></h2>
<h2>Editing this Page</h2>
<p>
To change the content of this page, create: <em>/app/views/pages/home.thtml</em>.<br />
To change its layout, create: <em>/app/views/layouts/default.thtml</em>.<br />
To change the content of this page, create: /app/views/pages/home.thtml.<br />
To change its layout, create: /app/views/layouts/default.thtml.<br />
<a href="http://wiki.cakephp.org/tutorials:sample_layout">See the wiki for more info</a><br />
You can also add some CSS styles for your pages at: <em>app/webroot/css/</em>.
You can also add some CSS styles for your pages at: app/webroot/css/.
</p>
<h2>More about <em>Cake</em></h2>
<h2>More about Cake</h2>
<p>
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like
Active Record, Association Data Mapping, Front Controller and MVC.
@ -56,24 +56,24 @@ Our primary goal is to provide a structured framework that enables PHP users at
to rapidly develop robust web applications, without any loss to flexibility.
</p>
<ul>
<li><a href="http://www.cakefoundation.org/">Cake<em>Software</em>Foundation</a>
<li><a href="http://www.cakefoundation.org/">Cake Software Foundation</a>
<ul><li>Promoting development related to CakePHP</li></ul></li>
<li><a href="http://www.cafepress.com/cakefoundation">Cake<em>Schwag</em></a>
<li><a href="http://www.cafepress.com/cakefoundation">CakeSchwag</a>
<ul><li>Get your own CakePHP gear - Doughnate to Cake</li></ul></li>
<li><a href="http://www.cakephp.org">Cake<em>PHP</em></a>
<li><a href="http://www.cakephp.org">CakePHP</a>
<ul><li>The Rapid Development Framework</li></ul></li>
<li><a href="http://manual.cakephp.org">Cake<em>PHP</em>Manual</a>
<li><a href="http://manual.cakephp.org">CakePHPManual</a>
<ul><li>Your Rapid Development Cookbook</li></ul></li>
<li><a href="http://wiki.cakephp.org">Cake<em>PHP</em>Wiki</a>
<li><a href="http://wiki.cakephp.org">CakePHPWiki</a>
<ul><li>The Community for CakePHP</li></ul></li>
<li><a href="http://api.cakephp.org">Cake<em>PHP</em>API</a>
<li><a href="http://api.cakephp.org">CakePHPAPI</a>
<ul><li>Docblock Your Best Friend</li></ul></li>
<li><a href="http://www.cakeforge.org">Cake<em>Forge</em></a>
<li><a href="http://www.cakeforge.org">CakeForge</a>
<ul><li>Open Development for CakePHP</li></ul></li>
<li><a href="https://trac.cakephp.org/">Cake<em>PHP</em>Trac</a>
<li><a href="https://trac.cakephp.org/">CakePHPTrac</a>
<ul><li>For the Development of CakePHP (Tickets, SVN browser, Roadmap, Changelogs)</li></ul></li>
<li><a href="http://groups-beta.google.com/group/cake-php">Cake<em>PHP</em> Google Group</a>
<li><a href="http://groups-beta.google.com/group/cake-php">CakePHP Google Group</a>
<ul><li>Community mailing list</li></ul></li>
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cake<em>php</em></a>
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
<ul><li>Live chat about CakePHP</li></ul></li>
</ul>

View file

@ -32,9 +32,11 @@ ini_set('display_errors', '1');
ini_set('error_reporting', '7');
$app = 'app';
$core = null;
$root = dirname(dirname(dirname(__FILE__)));
$core = null;
$here = $argv[0];
$help = null;
$project = null;
for ($i = 1; $i < count($argv); $i += 2)
{
@ -50,6 +52,14 @@ for ($i = 1; $i < count($argv); $i += 2)
case '-root':
$root = $argv[$i + 1];
break;
case '-help':
case '-h':
$help = true;
break;
case '-project':
$project = true;
$projectPath = $argv[$i + 1];
break;
}
}
@ -69,7 +79,7 @@ if(function_exists('ini_set'))
require_once (ROOT.'cake'.DS.'basics.php');
require_once (ROOT.'cake'.DS.'config'.DS.'paths.php');
require_once (ROOT.'cake'.DS.'dispatcher.php');
require_once (CONFIGS.'core.php');
require_once (ROOT.'cake'.DS.'scripts'.DS.'templates'.DS.'skel'.DS.'config'.DS.'core.php');
uses ('inflector');
uses ('model'.DS.'model');
@ -85,19 +95,35 @@ uses(DS.'controller'.DS.'scaffold');
$pattyCake = new Bake();
if($help === true)
{
$pattyCake->help();
exit();
}
if($project === true)
{
$pattyCake->project($projectPath);
exit();
}
$pattyCake->main();
class Bake {
var $stdin;
var $stdout;
var $stderr;
var $lowCtrl = null;
var $interactive = false;
function __construct()
{
$this->stdin = fopen('php://stdin', 'r');
$this->stdout = fopen('php://stdout', 'w');
$this->stderr = fopen('php://stderr', 'w');
$this->welcome();
}
function Bake()
@ -107,12 +133,6 @@ class Bake {
function main()
{
$this->stdout('');
$this->stdout('____ ____ _ _ ____ ___ _ _ ___ ___ ____ _ _ ____ ');
$this->stdout('| |__| |_/ |___ |__] |__| |__] |__] |__| |_/ |___ ');
$this->stdout('|___ | | | \_ |___ | | | | |__] | | | \_ |___ ');
$this->hr();
if(!file_exists(CONFIGS.'database.php'))
{
$this->stdout('');
@ -165,7 +185,7 @@ class Bake {
$this->hr();
$driver = 'mysql';
$connect = 'mysql_pconnect';
$connect = 'mysql_connect';
$host = '';
@ -242,6 +262,7 @@ class Bake {
$this->hr();
$this->stdout('Model Bake:');
$this->hr();
$this->interactive = true;
$dbConnection = 'default';
@ -573,7 +594,8 @@ class Bake {
$this->hr();
$this->stdout('View Bake:');
$this->hr();
$uses = array();
$wannaDoScaffold = 'y';
$controllerName = '';
$inflect = new Inflector();
@ -589,9 +611,15 @@ class Bake {
}
$controllerName = $inflect->underscore($controllerName);
$this->lowCtrl = $controllerName;
$doItInteractive = $this->getInput("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite {$controllerClassName} views if it exist.", array('y','n'), 'y');
if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes')
{
$this->interactive = true;
$wannaDoScaffold = $this->getInput("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');
$uses = array();
}
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoScaffold) == 'yes')
{
@ -647,7 +675,7 @@ class Bake {
$indexView .= "\t<th>Actions</th>\n";
$indexView .= "</tr>\n";
$indexView .= "<?php foreach (\$data as \$row): ?>\n";
$indexView .= "<?php foreach (\${$this->lowCtrl} as \$row): ?>\n";
$indexView .= "<tr>\n";
@ -717,13 +745,13 @@ class Bake {
$otherModelObject =& ClassRegistry::getObject(Inflector::underscore($objModel->tableToModel[$value['table']]));
$displayField = $otherModelObject->getDisplayField();
$viewView .= "\t<td><?php echo \$html->link(\$data['{$alias[$count]}']['{$displayField}'], '/" . $inflect->underscore($value['controller']) . "/view/' . \$data['{$objModel->tableToModel[$objModel->table]}']['{$field}'])?></td>\n";
$viewView .= "\t<td><?php echo \$html->link(\${$this->lowCtrl}['{$alias[$count]}']['{$displayField}'], '/" . $inflect->underscore($value['controller']) . "/view/' . \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['{$field}'])?></td>\n";
$count++;
}
else
{
$viewView .= "\t<td><?php echo \$data['{$objModel->tableToModel[$objModel->table]}']['{$field}']?></td>\n";
$viewView .= "\t<td><?php echo \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['{$field}']?></td>\n";
}
$viewView .= "</tr>\n";
@ -732,8 +760,8 @@ class Bake {
$viewView .= "</table>\n";
$viewView .= "<ul>\n";
$viewView .= "\t<li><?php echo \$html->link('Edit " . $inflect->humanize($objModel->name) . "', '/{$temp->viewPath}/edit/' . \$data['{$objModel->tableToModel[$objModel->table]}']['$id']) ?> </li>\n";
$viewView .= "\t<li><?php echo \$html->link('Delete " . $inflect->humanize($objModel->name) . "', '/{$temp->viewPath}/delete/' . \$data['{$objModel->tableToModel[$objModel->table]}']['$id']) ?> </li>\n";
$viewView .= "\t<li><?php echo \$html->link('Edit " . $inflect->humanize($objModel->name) . "', '/{$temp->viewPath}/edit/' . \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['$id']) ?> </li>\n";
$viewView .= "\t<li><?php echo \$html->link('Delete " . $inflect->humanize($objModel->name) . "', '/{$temp->viewPath}/delete/' . \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['$id']) ?> </li>\n";
$viewView .= "\t<li><?php echo \$html->link('List " . $inflect->humanize($objModel->name) ."', '/{$temp->viewPath}/index') ?> </li>\n";
$viewView .= "\t<li><?php echo \$html->link('New " . $inflect->humanize($objModel->name) . "', '/{$temp->viewPath}/add') ?> </li>\n";
@ -755,12 +783,12 @@ class Bake {
$new = true;
$viewView .= "<h2>Related " . $inflect->humanize($association) . "</h2>\n";
$viewView .= "<dl>\n";
$viewView .= "<?php if(isset(\$data['{$association}']) && is_array(\$data['{$association}'])): ?>\n";
$viewView .= "\t<?php foreach(\$data['{$association}'] as \$field => \$value): ?>\n";
$viewView .= "<?php if(isset(\${$this->lowCtrl}['{$association}']) && is_array(\${$this->lowCtrl}['{$association}'])): ?>\n";
$viewView .= "\t<?php foreach(\${$this->lowCtrl}['{$association}'] as \$field => \$value): ?>\n";
$viewView .= "\t\t<dt><?php echo \$field ?></dt>\n";
$viewView .= "\t\t<dd><?php echo \$value ?></dd>\n";
$viewView .= "\t<?php endforeach; ?>\n";
$viewView .= "\t<ul><li><?php echo \$html->link('New " . $inflect->humanize($association) . "', '/" .$inflect->underscore($controller)."/add/' . \$data['{$association}']['" . $objModel->{$model}->primaryKey . "'])?> </li></ul>\n";
$viewView .= "\t<ul><li><?php echo \$html->link('New " . $inflect->humanize($association) . "', '/" .$inflect->underscore($controller)."/add/' . \${$this->lowCtrl}['{$association}']['" . $objModel->{$model}->primaryKey . "'])?> </li></ul>\n";
$viewView .= "<?php endif ?>\n";
$viewView .= "</dl>\n";
@ -776,20 +804,20 @@ class Bake {
$controller = $inflect->pluralize($model);
$viewView .= "\n<h2>Related " . $inflect->humanize($inflect->pluralize($association)) . "</h2>\n";
$viewView .= "<?php if(isset(\$data['{$association}']) && is_array(\$data['{$association}'])):?>\n";
$viewView .= "<?php if(isset(\${$this->lowCtrl}['{$association}']['0']) && is_array(\${$this->lowCtrl}['{$association}'])):?>\n";
$viewView .= "<table>\n";
$viewView .= "<tr>\n";
$viewView .= "<?php foreach(\$data['{$association}'][0] as \$column => \$value): ?>\n";
$viewView .= "<?php foreach(\${$this->lowCtrl}['{$association}']['0'] as \$column => \$value): ?>\n";
$viewView .= "<th><?php echo \$column?></th>\n";
$viewView .= "<?php endforeach; ?>\n";
$viewView .= "<th>Actions</th>\n";
$viewView .= "</tr>\n";
$viewView .= "<?php foreach(\$data['{$association}'] as \$row):?>\n";
$viewView .= "<?php foreach(\${$this->lowCtrl}['{$association}'] as \$row):?>\n";
$viewView .= "<tr>\n";
@ -828,7 +856,6 @@ class Bake {
//-------------------------[ADD]-------------------------//
$addView .= "<h1>New " . $temp->modelKey . "</h1>\n";
$addView .= "<?php \$data = null;?>";
$fields .= $this->Html->formTag('/'. $temp->viewPath . '/add') . "\n";
$fields .= $this->generateFields($temp->generateFieldNames(null, true));
@ -847,10 +874,10 @@ class Bake {
$editView .= "<h1>Edit " . $temp->modelKey . "</h1>\n";
$editView .= "<form action=\"/{$temp->viewPath}/edit/<?php echo \$data['{$objModel->tableToModel[$objModel->table]}']['$id'] ?>\" method=\"post\">\n";
$editView .= "<form action=\"/{$temp->viewPath}/edit/<?php echo \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['$id'] ?>\" method=\"post\">\n";
$fields = $this->generateFields($temp->generateFieldNames(null, true));
$fields .= "<?php echo \$html->hidden('{$objModel->name}/{$id}', array('value' => \$data['{$objModel->tableToModel[$objModel->table]}']['$id']))?>";
$fields .= "<?php echo \$html->hidden('{$objModel->name}/{$id}', array('value' => \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['$id']))?>";
$fields .= $this->generateSubmitDiv('Save');
$editView .= $fields;
@ -935,7 +962,10 @@ class Bake {
$this->hr();
$controllerName = '';
$uses = array();
$helpers = array();
$components = array();
$wannaDoScaffolding = 'y';
while ($controllerName == '')
{
$controllerName = $this->getInput('Controller name? Remember that Cake controller names are plural.');
@ -950,8 +980,12 @@ class Bake {
$controllerClassName = $inflect->camelize($controllerName);
$doItInteractive = $this->getInput("Would you like bake to build your controller interactively?\nWarning: Choosing no will overwrite {$controllerClassName} controller if it exist.", array('y','n'), 'y');
if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes')
{
$this->interactive = true;
$wannaDoUses = $this->getInput("Would you like this controller to use other models besides '" . $inflect->singularize($controllerClassName) . "'?", array('y','n'), 'n');
$uses = array();
if (strtolower($wannaDoUses) == 'y' || strtolower($wannaDoUses) == 'yes')
{
@ -961,7 +995,6 @@ class Bake {
}
$wannaDoHelpers = $this->getInput("Would you like this controller to use other helpers besides HtmlHelper?", array('y','n'), 'n');
$helpers = array();
if (strtolower($wannaDoHelpers) == 'y' || strtolower($wannaDoHelpers) == 'yes')
{
@ -971,7 +1004,6 @@ class Bake {
}
$wannaDoComponents = $this->getInput("Would you like this controller to use any components?", array('y','n'), 'n');
$components = array();
if (strtolower($wannaDoComponents) == 'y' || strtolower($wannaDoComponents) == 'yes')
{
@ -981,18 +1013,25 @@ class Bake {
}
$wannaDoScaffolding = $this->getInput("Would to include some basic class methods (index(), add(), view(), edit())?", array('y','n'), 'n');
}
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes')
{
$controllerModel = $inflect->singularize($controllerClassName);
$this->lowCtrl = Inflector::underscore($controllerName);
loadModels();
if(!class_exists($controllerModel))
{
$this->stdout('You must have a model for this class to build scaffold methods. Please try again.');
exit;
}
$tempModel = new $controllerModel();
$actions .= "\n";
$actions .= "\tfunction index()\n";
$actions .= "\t{\n";
$actions .= "\t\t\$this->{$controllerModel}->recursive = 0;\n";
$actions .= "\t\t\$this->set('data', \$this->{$controllerModel}->findAll());\n";
$actions .= "\t\t\$this->set('{$this->lowCtrl}', \$this->{$controllerModel}->findAll());\n";
$actions .= "\t}\n";
$actions .= "\n";
@ -1000,39 +1039,143 @@ class Bake {
$actions .= "\t{\n";
$actions .= "\t\tif(empty(\$this->data))\n";
$actions .= "\t\t{\n";
$actions .= "\t\t\t\$this->render();\n";
foreach($tempModel->hasAndBelongsToMany as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$lowerName = strtolower($association);
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\$this->set('selected{$model}', null);\n";
}
}
foreach($tempModel->belongsTo as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
$actions .= "\t\t\t\$this->set('{$this->lowCtrl}', null);\n";
$actions .= "\t\t}\n";
$actions .= "\t\telse\n";
$actions .= "\t\t{\n";
$actions .= "\t\t\t\$this->cleanUpFields();\n";
$actions .= "\t\t\tif(\$this->{$controllerModel}->save(\$this->data))\n";
$actions .= "\t\t\t{\n";
$actions .= "\t\t\t\t\$this->flash('{$controllerModel} saved.', '/{$controllerName}/index');\n";
$actions .= "\t\t\t\t\$this->flash('{$controllerModel} saved.', '/{$this->lowCtrl}/index');\n";
$actions .= "\t\t\t}\n";
$actions .= "\t\t\telse\n";
$actions .= "\t\t\t{\n";
$actions .= "\t\t\t\t\$this->render();\n";
$actions .= "\t\t\t\t\$data = \$this->data;\n";
$actions .= "\t\t\t\t\$this->set('{$this->lowCtrl}', \$data);\n";
foreach($tempModel->hasAndBelongsToMany as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$associationModel = new $model();
$lowerName = strtolower($association);
$actions .= "\t\t\t\t\${$lowerName} = null;\n";
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\tif(isset(\$data['{$model}']['{$model}']))\n";
$actions .= "\t\t\t\t{\n";
$actions .= "\t\t\t\t\tforeach(\$data['{$model}']['{$model}'] as \$var)\n";
$actions .= "\t\t\t\t\t{\n";
$actions .= "\t\t\t\t\t\t\${$lowerName}[\$var] = \$var;\n";
$actions .= "\t\t\t\t\t}\n";
$actions .= "\t\t\t\t}\n";
$actions .= "\t\t\t\t\$this->set('selected{$model}', \${$lowerName});\n";
}
}
foreach($tempModel->belongsTo as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
$actions .= "\t\t\t}\n";
$actions .= "\t\t}\n";
$actions .= "\t}\n";
$actions .= "\n";
$actions .= "\tfunction edit(\$id)\n";
$actions .= "\t{\n";
$actions .= "\t\tif(empty(\$this->data))\n";
$actions .= "\t\t{\n";
$actions .= "\t\t\t\$this->set('data', \$this->{$controllerModel}->find('{$controllerModel}.{$tempModel->primaryKey} = ' . \$id));\n";
$actions .= "\t\t\t\$data = \$this->{$controllerModel}->read(null, \$id);\n";
$actions .= "\t\t\t\$this->set('{$this->lowCtrl}', \$data );\n";
foreach($tempModel->hasAndBelongsToMany as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$associationModel = new $model();
$lowerName = strtolower($association);
$actions .= "\t\t\t\${$lowerName} = null;\n";
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\tforeach(\$data['{$model}'] as \$var)\n";
$actions .= "\t\t\t{\n";
$actions .= "\t\t\t\t\${$lowerName}[\$var['{$associationModel->primaryKey}']] = \$var['{$associationModel->primaryKey}'];\n";
$actions .= "\t\t\t}\n";
$actions .= "\t\t\t\$this->set('selected{$model}', \${$lowerName});\n";
}
}
foreach($tempModel->belongsTo as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
$actions .= "\t\t}\n";
$actions .= "\t\telse\n";
$actions .= "\t\t{\n";
$actions .= "\t\t\t\$this->cleanUpFields();\n";
$actions .= "\t\t\tif(\$this->{$controllerModel}->save(\$this->data))\n";
$actions .= "\t\t\t{\n";
$actions .= "\t\t\t\t\$this->flash('{$controllerModel} saved.', '/{$controllerName}/index');\n";
$actions .= "\t\t\t\t\$this->flash('{$controllerModel} saved.', '/{$this->lowCtrl}/index');\n";
$actions .= "\t\t\t}\n";
$actions .= "\t\t\telse\n";
$actions .= "\t\t\t{\n";
$actions .= "\t\t\t\t\$this->set('data', \$this->data);\n";
$actions .= "\t\t\t\t\$this->validateErrors(\$this->{$controllerModel});\n";
$actions .= "\t\t\t\t\$this->render();\n";
$actions .= "\t\t\t\t\$data = \$this->data;\n";
$actions .= "\t\t\t\t\$this->set('{$this->lowCtrl}', \$data);\n";
foreach($tempModel->hasAndBelongsToMany as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$associationModel = new $model();
$lowerName = strtolower($association);
$actions .= "\t\t\t\t\${$lowerName} = null;\n";
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\tif(isset(\$data['{$model}']['{$model}']))\n";
$actions .= "\t\t\t\t{\n";
$actions .= "\t\t\t\t\tforeach(\$data['{$model}']['{$model}'] as \$var)\n";
$actions .= "\t\t\t\t\t{\n";
$actions .= "\t\t\t\t\t\t\${$lowerName}[\$var] = \$var;\n";
$actions .= "\t\t\t\t\t}\n";
$actions .= "\t\t\t\t}\n";
$actions .= "\t\t\t\t\$this->set('selected{$model}', \${$lowerName});\n";
}
}
foreach($tempModel->belongsTo as $association => $relation)
{
if(!empty($relation['className']))
{
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
$actions .= "\t\t\t}\n";
$actions .= "\t\t}\n";
$actions .= "\t}\n";
@ -1040,42 +1183,26 @@ class Bake {
$actions .= "\n";
$actions .= "\tfunction view(\$id)\n";
$actions .= "\t{\n";
$actions .= "\t\t\$this->set('data', \$this->{$controllerModel}->find('{$controllerModel}.{$tempModel->primaryKey} = ' . \$id));\n";
$actions .= "\t\t\$this->set('{$this->lowCtrl}', \$this->{$controllerModel}->read(null, \$id));\n";
$actions .= "\t}\n";
$actions .= "\n";
$actions .= "\tfunction delete(\$id)\n";
$actions .= "\t{\n";
$actions .= "\t\t\$this->{$controllerModel}->del(\$id);\n";
$actions .= "\t\t\$this->redirect('/{$controllerName}/index');\n";
$actions .= "\t\t\$this->redirect('/{$this->lowCtrl}/index');\n";
$actions .= "\t}\n";
$actions .= "\n";
}
$lowerCaseModel = strtolower(substr($controllerModel, 0, 1)) . substr($controllerModel, 1);
if($tempModel->displayField === null)
if($this->interactive === true)
{
$tempModel->displayField = 'name';
}
$actions .= "\tfunction {$lowerCaseModel}List()\n";
$actions .= "\t{\n";
$actions .= "\t\t\$this->{$controllerModel}->recursive = 0;\n";
$actions .= "\t\t\$vars = \$this->{$controllerModel}->findAll(null,'{$tempModel->name}.{$tempModel->primaryKey}, {$tempModel->name}.{$tempModel->displayField}');\n";
$actions .= "\t\tforeach(\$vars as \$var)\n";
$actions .= "\t\t{\n";
$actions .= "\t\t\t\$list[\$var['{$controllerModel}']['{$tempModel->primaryKey}']] = \$var['{$controllerModel}']['{$tempModel->displayField}'];\n";
$actions .= "\t\t}\n";
$actions .= "\n";
$actions .= "\t\treturn \$list;\n";
$actions .= "\t}\n";
}
$this->stdout('');
$this->hr();
$this->stdout('The following controller will be created:');
$this->hr();
$this->stdout("Controller Name: $controllerName");
if(count($uses))
{
$this->stdout("Uses: ", false);
@ -1091,6 +1218,7 @@ class Bake {
}
}
}
if(count($helpers))
{
$this->stdout("Helpers: ", false);
@ -1106,6 +1234,7 @@ class Bake {
}
}
}
if(count($components))
{
$this->stdout("Components: ", false);
@ -1121,6 +1250,7 @@ class Bake {
}
}
}
$this->hr();
$looksGood = $this->getInput('Look okay?', array('y','n'), 'y');
@ -1139,6 +1269,12 @@ class Bake {
$this->stdout('Bake Aborted.');
}
}
else
{
$this->bakeController($controllerClassName, $uses, $helpers, $components, $actions);
exit();
}
}
function doUnitTest()
{
@ -1164,7 +1300,7 @@ class Bake {
$out .= "{\n";
$out .= "\tvar \$default = array(\n";
$out .= "\t\t'driver' => 'mysql',\n";
$out .= "\t\t'connect' => 'mysql_pconnect',\n";
$out .= "\t\t'connect' => 'mysql_connect',\n";
$out .= "\t\t'host' => '$host',\n";
$out .= "\t\t'login' => '$login',\n";
$out .= "\t\t'password' => '$password',\n";
@ -1209,6 +1345,7 @@ class Bake {
if(count($modelAssociations['belongsTo']) || count($modelAssociations['hasOne']) || count($modelAssociations['hasMany']) || count($modelAssociations['hasAndBelongsToMany']))
{
$out.= "\t//The Associations below have been created with all possible keys, those that are not needed can be removed\n";
if(count($modelAssociations['belongsTo']))
{
$out .= "\tvar \$belongsTo = array(\n";
@ -1528,8 +1665,8 @@ class Bake {
{
echo "\nCreating file $path\n";
$shortPath = str_replace(ROOT,null,$path);
if (is_file($path) && !$this->dontAsk)
$path = str_replace('//', '/', $path);
if (is_file($path) && $this->interactive === true)
{
fwrite($this->stdout, "File {$shortPath} exists, overwrite? (y/n/q):");
$key = trim(fgets($this->stdin));
@ -1687,7 +1824,7 @@ class Bake {
$htmlAttributes['rows'] = $rows;
$tagNameArray = explode('/', $tagName);
$htmlAttributes['value'] = "\$data['{$tagNameArray[0]}']['{$tagNameArray[1]}']";
$htmlAttributes['value'] = "\${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}']";
$str = "\t<?php echo \$html->textarea('{$tagName}', " . $this->attributesToArray($htmlAttributes) . ") ?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
@ -1718,7 +1855,7 @@ class Bake {
$htmlOptions['id'] = strtolower(str_replace('/', '_',$tagName));
$tagNameArray = explode('/', $tagName);
$htmlAttributes['checked'] = "\$data['{$tagNameArray[0]}']['{$tagNameArray[1]}'] ? 'checked' : ''";
$htmlAttributes['checked'] = "\${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}'] ? 'checked' : ''";
$str = "\t<?php echo \$html->checkbox('{$tagName}', null, " . $this->attributesToArray($htmlAttributes) . ")?>\n";
@ -1748,7 +1885,7 @@ class Bake {
{
$htmlOptions['id'] = strtolower(str_replace('/', '_',$tagName));
$tagNameArray = explode('/', $tagName);
$str = "\t<?php echo \$html->dateTimeOptionTag('{$tagName}', 'MDY' , 'NONE', \$data['{$tagNameArray[0]}']['{$tagNameArray[1]}'], " . $this->attributesToArray($htmlOptions) . ")?>\n";
$str = "\t<?php echo \$html->dateTimeOptionTag('{$tagName}', 'MDY' , 'NONE', \${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}'], " . $this->attributesToArray($htmlOptions) . ")?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
$strLabel = "\n\t" . $this->labelTag( $tagName, $prompt );
@ -1776,7 +1913,7 @@ class Bake {
{
$htmlOptions['id'] = strtolower(str_replace('/', '_',$tagName));
$tagNameArray = explode('/', $tagName);
$str = "\t<?php echo \$html->dateTimeOptionTag('{$tagName}', 'MDY' , '12', \$data['{$tagNameArray[0]}']['{$tagNameArray[1]}'], " . $this->attributesToArray($htmlOptions) . ")?>\n";
$str = "\t<?php echo \$html->dateTimeOptionTag('{$tagName}', 'MDY' , '12', \${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}'], " . $this->attributesToArray($htmlOptions) . ")?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
$strLabel = "\n\t" . $this->labelTag( $tagName, $prompt );
$divClass = "optional";
@ -1807,7 +1944,7 @@ class Bake {
$htmlAttributes['size'] = $size;
$tagNameArray = explode('/', $tagName);
$htmlAttributes['value'] = "\$data['{$tagNameArray[0]}']['{$tagNameArray[1]}']";
$htmlAttributes['value'] = "\${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}']";
$str = "\t<?php echo \$html->input('{$tagName}', " . $this->attributesToArray($htmlAttributes) . ") ?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
@ -1844,21 +1981,15 @@ class Bake {
$controllerPath = strtolower(substr($inflect->pluralize($properModel), 0, 1)) . substr($inflect->pluralize($properModel), 1);
$actionPath = strtolower(substr($properModel, 0, 1)) . substr($properModel, 1) . 'List';
$path = "/$controllerPath/$actionPath";
$lowerName = strtolower($tagNameArray[0]);
if($selectAttr['multiple'] != 'multiple')
{
$str = "\t<?php echo \$html->selectTag('{$tagName}', " . "\$this->requestAction('{$path}'), \$data['{$tagNameArray[0]}']['{$tagNameArray[1]}'], " . $this->attributesToArray($selectAttr) . ") ?>\n";
$str = "\t<?php echo \$html->selectTag('{$tagName}', " . "\${$model}Array, \${$this->lowCtrl}['{$tagNameArray[0]}']['{$tagNameArray[1]}'], " . $this->attributesToArray($selectAttr) . ") ?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
}
else
{
$lowerName = strtolower($tagNameArray[0]);
$str = "\t<?php if(isset(\$data['{$tagNameArray[0]}'])): ?>\n";
$str .= "\t<?php foreach (\$data['{$tagNameArray[0]}'] as \$var): \${$lowerName}Options[\$var['id']] = \$var['id']; endforeach; ?>\n";
$str .= "\t<?php else: ?>\n";
$str .= "\t<?php \${$lowerName}Options = null;?>\n";
$str .= "\t<?php endif ?>\n";
$str .= "\t<?php echo \$html->selectTag('{$tagName}', " . "\$this->requestAction('{$path}'), \${$lowerName}Options, " . $this->attributesToArray($selectAttr) . ") ?>\n";
$str = "\t<?php echo \$html->selectTag('{$tagName}', \${$lowerName}Array, \$selected{$tagNameArray[0]}, array('multiple' => 'multiple', 'class' => 'selectMultiple', 'id' => '{$lowerName}_{$lowerName}', )) ?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Error message for {$tagNameArray[1]} goes here.') ?>\n";
}
@ -1917,8 +2048,6 @@ class Bake {
return sprintf( TAG_DIV, $class, $text ) . "\n";
}
//=-=-=-=
function attributesToArray($htmlAttributes)
{
if (is_array($htmlAttributes))
@ -1955,12 +2084,241 @@ class Bake {
return 'array()';
}
}
function help()
{
$doItInteractive = $this->getInput("The help section is not completed use interactive mode?", array('y','n'), 'y');
if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes')
{
$this->interactive = true;
$this->main();
}
}
/*
@@@
Make options array in selectTag dynamic (create a listModels function in the controller and use requestAction?)
function project($projectPath)
{
if($projectPath != '')
{
while ($this->__checkPath($projectPath) === true)
{
$projectPath = $this->getInput('Directory exists please choose another name:');
$this->__buildDirLayout($projectPath);
exit();
}
}
else
{
while ($projectPath == '')
{
$projectPath = $this->getInput("What is the full path for this app including the app directory name?\nExample: ".ROOT."myapp", null, ROOT.'myapp');
*/
if ($projectPath == '')
{
$this->stdout('The directory path you supplied was empty. Please try again.');
}
}
}
while ($this->__checkPath($projectPath) === true || $projectPath == '')
{
$projectPath = $this->getInput('Directory path exists please choose another:');
while ($projectPath == '')
{
$projectPath = $this->getInput('The directory path you supplied was empty. Please try again.');
}
}
$parentPath = explode(DS, $projectPath);
$count = count($parentPath);
$appName = $parentPath[$count - 1];
unset($parentPath[$count - 1]);
$parentPath = implode(DS, $parentPath);
if(!is_writable($parentPath))
{
$projectPath = $this->getInput('The directory path is not writable. Please try again');
$this->project($projectPath);
}
$this->__buildDirLayout($projectPath, $appName);
exit();
}
function __checkPath($projectPath)
{
if(is_dir($projectPath))
{
return true;
}
else
{
return false;
}
}
function __buildDirLayout($projectPath, $appName)
{
$skel = '';
if($this->__checkPath(ROOT.'cake'.DS.'scripts'.DS.'templates'.DS.'skel') === true)
{
$skel = ROOT.'cake'.DS.'scripts'.DS.'templates'.DS.'skel';
}
else
{
while ($skel == '')
{
$skel = $this->getInput("What is the full path for the cake install app directory?\nExample: ", null, ROOT.'app'.DS);
if ($skel == '')
{
$this->stdout('The directory path you supplied was empty. Please try again.');
}
else
{
while ($this->__checkPath($skel) === false)
{
$skel = $this->getInput('Directory path does not exist please choose another:');
}
}
}
}
$this->stdout('');
$this->hr();
$this->stdout("Skel Directory: $skel");
$this->stdout("Will be copied to:");
$this->stdout("New App Direcotry: $projectPath");
$this->hr();
$looksGood = $this->getInput('Look okay?', array('y', 'n', 'q'), 'y');
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes')
{
$verboseOuptut = $this->getInput('Do you want verbose output?', array('y', 'n'), 'n');
$verbose = false;
if (strtolower($verboseOuptut) == 'y' || strtolower($verboseOuptut) == 'yes')
{
$verbose = true;
}
$this->copydirr($skel, $projectPath, 0755, $verbose);
$this->hr();
$this->stdout('Created: '.$projectPath);
$this->hr();
$this->stdout('Creating welcome page');
$this->hr();
$this->__defaultHome($projectPath, $appName);
$this->stdout('Welcome page created');
if(chmodr($projectPath.DS.'tmp', 0777) === false)
{
$this->stdout('Could not set permissions on '. $projectPath.DS.'tmp'.DS.'*');
$this->stdout('You must manually check that these directories can be wrote to by the server');
}
return;
}
elseif (strtolower($looksGood) == 'q' || strtolower($looksGood) == 'quit')
{
$this->stdout('Bake Aborted.');
}
else
{
$this->project($projectPath);
}
}
function copydirr($fromDir, $toDir, $chmod = 0755, $verbose = false)
{
$errors=array();
$messages=array();
if (!is_dir($toDir))
{
mkdir($toDir, 0755);
}
if (!is_writable($toDir))
{
$errors[]='target '.$toDir.' is not writable';
}
if (!is_dir($fromDir))
{
$errors[]='source '.$fromDir.' is not a directory';
}
if (!empty($errors))
{
if ($verbose)
{
foreach($errors as $err)
{
$this->stdout('Error: '.$err);
}
}
return false;
}
$exceptions=array('.','..');
$handle = opendir($fromDir);
while (false!==($item = readdir($handle)))
{
if (!in_array($item,$exceptions))
{
$from = str_replace('//','/',$fromDir.'/'.$item);
$to = str_replace('//','/',$toDir.'/'.$item);
if (is_file($from))
{
if (@copy($from, $to))
{
chmod($to, $chmod);
touch($to, filemtime($from));
$messages[]='File copied from '.$from.' to '.$to;
}
else
{
$errors[]='cannot copy file from '.$from.' to '.$to;
}
}
if (is_dir($from))
{
if (@mkdir($to))
{
chmod($to,$chmod);
$messages[]='Directory created: '.$to;
}
else
{
$errors[]='cannot create directory '.$to;
}
$this->copydirr($from,$to,$chmod,$verbose);
}
}
}
closedir($handle);
if ($verbose)
{
foreach($errors as $err)
{
$this->stdout('Error: '.$err);
}
foreach($messages as $msg)
{
$this->stdout($msg);
}
}
return true;
}
function welcome()
{
$this->stdout('');
$this->stdout(' ___ __ _ _ ___ __ _ _ __ __ __ _ _ ___ ');
$this->stdout('| |__| |_/ |__ |__] |__| |__] |__] |__| |_/ |__ ');
$this->stdout('|___ | | | \_ |___ | | | | |__] | | | \_ |___ ');
$this->hr();
$this->stdout('');
}
function __defaultHome($dir, $app)
{
$path = $dir.DS.'views'.DS.'pages'.DS;
include(ROOT.'cake'.DS.'scripts'.DS.'templates'.DS.'views'.DS.'home.thtml');
$this->createFile($path.'home.thtml', $output);
}
}
?>

View file

@ -0,0 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>

View file

@ -0,0 +1,76 @@
;<?php die() ?>
; SVN FILE: $Id$
;/**
; * Short description for file.
; *
; *
; * PHP versions 4 and 5
; *
; * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
; * Copyright (c) 2006, Cake Software Foundation, Inc.
; * 1785 E. Sahara Avenue, Suite 490-204
; * Las Vegas, Nevada 89104
; *
; * Licensed under The MIT License
; * Redistributions of files must retain the above copyright notice.
; *
; * @filesource
; * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
; * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
; * @package cake
; * @subpackage cake.app.config
; * @since CakePHP v 0.10.0.1076
; * @version $Revision$
; * @modifiedby $LastChangedBy$
; * @lastmodified $Date$
; * @license http://www.opensource.org/licenses/mit-license.php The MIT License
; */
; acl.ini.php - Cake ACL Configuration
; ---------------------------------------------------------------------
; Use this file to specify user permissions.
; aco = access control object (something in your application)
; aro = access request object (something requesting access)
;
; User records are added as follows:
;
; [uid]
; groups = group1, group2, group3
; allow = aco1, aco2, aco3
; deny = aco4, aco5, aco6
;
; Group records are added in a similar manner:
;
; [gid]
; allow = aco1, aco2, aco3
; deny = aco4, aco5, aco6
;
; The allow, deny, and groups sections are all optional.
; NOTE: groups names *cannot* ever be the same as usernames!
;
; ACL permissions are checked in the following order:
; 1. Check for user denies (and DENY if specified)
; 2. Check for user allows (and ALLOW if specified)
; 3. Gather user's groups
; 4. Check group denies (and DENY if specified)
; 5. Check group allows (and ALLOW if specified)
; 6. If no aro, aco, or group information is found, DENY
;
; ---------------------------------------------------------------------
;-------------------------------------
;Users
;-------------------------------------
[username-goes-here]
groups = group1, group2
deny = aco1, aco2
allow = aco3, aco4
;-------------------------------------
;Groups
;-------------------------------------
[groupname-goes-here]
deny = aco5, aco6
allow = aco7, aco8

View file

@ -0,0 +1,50 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.10.8.2117
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
*
* This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
* This is an application wide file to load any function that is not used within a class define.
* You can also use this to include or require any files in your application.
*
*/
/**
* The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
* $modelPaths = array('full path to models', 'second full path to models', 'etc...');
* $viewPaths = array('this path to views', 'second full path to views', 'etc...');
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
*
*/
//EOF
?>

View file

@ -0,0 +1,153 @@
<?php
/* SVN FILE: $Id$ */
/**
* This is core configuration file.
*
* Use it to configure core behaviour ofCake.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* If you do not have mod rewrite on your system
* or if you prefer to use CakePHP pretty urls.
* uncomment the line below.
* Note: If you do have mod rewrite but prefer the
* CakePHP pretty urls, you also have to remove the
* .htaccess files
* release/.htaccess
* release/app/.htaccess
* release/app/webroot/.htaccess
*/
//define ('BASE_URL', env('SCRIPT_NAME'));
/**
* Set debug level here:
* - 0: production
* - 1: development
* - 2: full debug with sql
* - 3: full debug with sql and dump of the current object
*
* In production, the "flash messages" redirect after a time interval.
* With the other debug levels you get to click the "flash message" to continue.
*
*/
define('DEBUG', 1);
/**
* Turn of caching checking wide.
* You must still use the controller var cacheAction inside you controller class.
* You can either set it controller wide, or in each controller method.
* use var $cacheAction = true; or in the controller method $this->cacheAction = true;
*/
define ('CACHE_CHECK', false);
/**
* Error constant. Used for differentiating error logging and debugging.
* Currently PHP supports LOG_DEBUG
*/
define ('LOG_ERROR', 2);
/**
* CakePHP includes 3 types of session saves
* database or file. Set this to your preferred method.
* If you want to use your own save handler place it in
* app/config/name.php DO NOT USE file or database as the name.
* and use just the name portion below.
*
* Setting this to cake will save files to /cakedistro/tmp directory
* Setting it to php will use the php default save path
* Setting it to database will use the database
*
*
*/
define('CAKE_SESSION_SAVE', 'php');
/**
* Set a random string of used in session.
*
*/
define('CAKE_SESSION_STRING', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
/**
* Set the name of session cookie
*
*/
define('CAKE_SESSION_COOKIE', 'CAKEPHP');
/**
* Set level of Cake security.
*
*/
define('CAKE_SECURITY', 'high');
/**
* Set Cake Session time out.
* If CAKE_SECURITY define is set
* high: multiplied by 10
* medium: is multiplied by 100
* low is: multiplied by 300
*
* Number below is seconds.
*/
define('CAKE_SESSION_TIMEOUT', '120');
/**
* Uncomment the define below to use cake built in admin routes.
* You can set this value to anything you want.
* All methods related to the admin route should be prefixed with the
* name you set CAKE_ADMIN to.
* For example: admin_index, admin_edit
*/
//define('CAKE_ADMIN', 'admin');
/**
* The define below is used to turn cake built webservices
* on or off. Default setting is off.
*/
define('WEBSERVICES', 'off');
/**
* Compress output CSS (removing comments, whitespace, repeating tags etc.)
* This requires a/var/cache directory to be writable by the web server (caching).
* To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use Controller::cssTag().
*/
define('COMPRESS_CSS', false);
/**
* If set to true, helpers would output data instead of returning it.
*/
define('AUTO_OUTPUT', false);
/**
* If set to false, session would not automatically be started.
*/
define('AUTO_SESSION', true);
/**
* Set the max size of file to use md5() .
*/
define('MAX_MD5SIZE', (5*1024)*1024 );
/**
* To use Access Control Lists with Cake...
*/
define('ACL_CLASSNAME', 'DB_ACL');
define('ACL_FILENAME', 'dbacl'.DS.'db_acl');
?>

View file

@ -0,0 +1,79 @@
<?php
/* SVN FILE: $Id$ */
/**
* This is core configuration file.
*
* Use it to configure core behaviour ofCake.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* In this file you set up your database connection details.
*
* @package cake
* @subpackage cake.config
*/
/**
* Database configuration class.
* You can specify multiple configurations for production, development and testing.
*
* driver =>
* mysql, postgres, sqlite, adodb-drivername, pear-drivername
*
* connect =>
* MySQL set the connect to either mysql_pconnect of mysql_connect
* PostgreSQL set the connect to either pg_pconnect of pg_connect
* SQLite set the connect to sqlite_popen sqlite_open
* ADOdb set the connect to one of these
* (http://phplens.com/adodb/supported.databases.html) and
* append it '|p' for persistent connection. (mssql|p for example, or just mssql for not persistent)
*
* host =>
* the host you connect to the database
* MySQL 'localhost' to add a port number use 'localhost:port#'
* PostgreSQL 'localhost' to add a port number use 'localhost port=5432'
*
*/
class DATABASE_CONFIG
{
var $default = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'project_name',
'prefix' => '');
var $test = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'project_name-test',
'prefix' => '');
}
?>

View file

@ -0,0 +1,74 @@
<?php
/* SVN FILE: $Id$ */
/**
* Custom Inflected Words.
*
* This file is used to hold words that are not matched in the normail Inflector::pluralize() and
* Inflector::singularize()
*
* PHP versions 4 and %
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 1.0.0.2312
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* This is a key => value array of regex used to match words.
* If key matches then the value is returned.
*
* $pluralRules = array('/(s)tatus$/i' => '\1\2tatuses', '/^(ox)$/i' => '\1\2en', '/([m|l])ouse$/i' => '\1ice');
*/
$pluralRules = array();
/**
* This is a key only array of plural words that should not be inflected.
* Notice the last comma
*
* $uninflectedPlural = array('.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox');
*/
$uninflectedPlural = array();
/**
* This is a key => value array of plural irregular words.
* If key matches then the value is returned.
*
* $irregularPlural = array('atlas' => 'atlases', 'beef' => 'beefs', 'brother' => 'brothers')
*/
$irregularPlural = array();
/**
* This is a key => value array of regex used to match words.
* If key matches then the value is returned.
*
* $singularRules = array('/(s)tatuses$/i' => '\1\2tatus', '/(matr)ices$/i' =>'\1ix','/(vert|ind)ices$/i')
*/
$singularRules = array();
/**
* This is a key only array of singular words that should not be inflected.
* You should not have to change this value below if you do change it use same format
* as the $uninflectedPlural above.
*/
$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
*
* $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
*/
$irregularSingular = array_flip($irregularPlural);
?>

View file

@ -0,0 +1,51 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different urls to chosen controllers and their actions (functions).
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/views/pages/home.thtml)...
*/
$Route->connect ('/', array('controller'=>'pages', 'action'=>'display', 'home'));
/**
* ...and connect the rest of 'Pages' controller's urls.
*/
$Route->connect ('/pages/*', array('controller'=>'pages', 'action'=>'display'));
/**
* Then we connect url '/test' to our test controller. This is helpfull in
* developement.
*/
$Route->connect ('/tests', array('controller'=>'tests', 'action'=>'index'));
?>

View file

@ -0,0 +1,30 @@
CREATE TABLE `acos` (
`id` int(11) NOT NULL auto_increment,
`model` varchar(255) NOT NULL default '',
`object_id` int(11) default NULL,
`alias` varchar(255) NOT NULL default '',
`lft` int(11) default NULL,
`rght` int(11) default NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `aros` (
`id` int(11) NOT NULL auto_increment,
`model` varchar(255) NOT NULL default '',
`user_id` int(11) default NULL,
`alias` varchar(255) NOT NULL default '',
`lft` int(11) default NULL,
`rght` int(11) default NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `aros_acos` (
`id` int(11) NOT NULL auto_increment,
`aro_id` int(11) default NULL,
`aco_id` int(11) default NULL,
`_create` int(1) NOT NULL default '0',
`_read` int(1) NOT NULL default '0',
`_update` int(1) NOT NULL default '0',
`_delete` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);

View file

@ -0,0 +1,11 @@
-- @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
-- @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
-- @since CakePHP v 0.10.8.1997
-- @version $Revision$
CREATE TABLE cake_sessions (
id varchar(255) NOT NULL default '',
data text,
expires int(11) default NULL,
PRIMARY KEY (id)
);

View file

@ -0,0 +1,27 @@
<?php
/* SVN FILE: $Id$ */
/**
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app
* @since CakePHP v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
require 'webroot'.DIRECTORY_SEPARATOR.'index.php';
?>

View file

@ -0,0 +1,31 @@
<?php
/* SVN FILE: $Id$ */
/**
*
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @since CakePHP v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<?php echo $content_for_layout; ?>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CakePHP : <?php echo $title_for_layout?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<?php echo $html->css('generic.basic');?>
<?php echo $html->css('generic.forms');?>
</head>
<body>
<div id="container">
<div id="header">
<h1>CakePHP Rapid Development</h1>
</div>
<div id="content">
<?php
if ($this->controller->Session->check('Message.flash'))
$this->controller->Session->flash();
?>
<?php echo $content_for_layout?>
</div>
<div id="footer">
&nbsp;
<a href="http://www.cakephp.org/" target="_new">
<?php echo $html->image('cake.power.png', array('alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"))?>
</a>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,51 @@
<?php
/* SVN FILE: $Id$ */
/**
*
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @since CakePHP v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $page_title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php if(DEBUG == 0) { ?>
<meta http-equiv="Refresh" content="<?php echo $pause?>;url=<?php echo $url?>"/>
<?php } ?>
<style><!--
P { text-align:center; font:bold 1.1em sans-serif }
A { color:#444; text-decoration:none }
A:HOVER { text-decoration: underline; color:#44E }
--></style>
</head>
<body>
<p><a href="<?php echo $url?>"><?php echo $message?></a></p>
</body>
</html>

View file

@ -0,0 +1,6 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

View file

@ -0,0 +1,116 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.webroot
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/
require(CONFIGS.'paths.php');
require(CAKE.'basics.php');
require(LIBS.'folder.php');
require(LIBS.'file.php');
require(LIBS.'legacy.php');
/**
* Enter description here...
*
* @param unknown_type $path
* @param unknown_type $name
* @return unknown
*/
function make_clean_css ($path, $name)
{
require(VENDORS.'csspp'.DS.'csspp.php');
$data = file_get_contents($path);
$csspp = new csspp();
$output = $csspp->compress($data);
$ratio = 100-(round(strlen($output)/strlen($data), 3)*100);
$output = " /* file: $name, ratio: $ratio% */ " . $output;
return $output;
}
/**
* Enter description here...
*
* @param unknown_type $path
* @param unknown_type $content
* @return unknown
*/
function write_css_cache ($path, $content)
{
if (!is_dir(dirname($path)))
mkdir(dirname($path));
$cache = new File($path);
return $cache->write($content);
}
if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs))
die('Wrong file name.');
$filename = 'css/'.$regs[1];
$filepath = CSS.$regs[1];
$cachepath = CACHE.'css'.DS.str_replace(array('/','\\'), '-', $regs[1]);
if (!file_exists($filepath))
die('Wrong file name.');
if (file_exists($cachepath))
{
$templateModified = filemtime($filepath);
$cacheModified = filemtime($cachepath);
if ($templateModified > $cacheModified)
{
$output = make_clean_css ($filepath, $filename);
write_css_cache ($cachepath, $output);
}
else
{
$output = file_get_contents($cachepath);
}
}
else
{
$output = make_clean_css ($filepath, $filename);
write_css_cache ($cachepath, $output);
}
header("Date: ".date("D, j M Y G:i:s ", $templateModified).'GMT');
header("Content-Type: text/css");
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;
?>

View file

@ -0,0 +1,176 @@
*{
margin:0;
padding:0;
}
body{
font-family:verdana,helvetica,arial,sans-serif;
font-size:12px;
text-align:center;
color:#333;
background:#fff;
line-height: 18px;
}
/*
* General Style Info
*/
a{
color:#003d4c;
text-decoration:none;
}
a:hover{
color:#003d4c;
text-decoration:underline;
}
a img{
border:none;
}
h1, h2, h3, h4{
font-family:'Gill Sans';
font-weight:normal;
}
h1{
font-size:28px;
padding:0.5em 0;
color:#003d4c;
}
em {
font-size: 12px;
}
h2{
font-size:24px;
padding-top:0.15em;
margin:0.3em 0;
color:#e32000;
}
h3{
font-size:18px;
padding-top:0.5em;
color:#003d4c;
}
h4{
color:#ff9966;
font-size:16px;
padding-top:0.5em;
font-weight:normal;
}
ul, li {
margin: 0 12px;
}
/*
* Layout
*/
#container{
text-align:left;
}
#header{
background:#003d4c;
padding: 4px 20px;
}
#header h1{
color:#fff;
font-family: 'Gill Sans';
font-size: 45px;
font-weight:normal;
}
#content{
padding: 10px 40px;
}
#footer{
padding: 6px 10px;
background:#003d4c;
text-align: right;
}
/* tables */
table {
width: 100%;
border: 1px solid #003d4c;
color:#333;
background-color: #fff;
clear:both;
padding: 0;
margin: 0 0 2em 0;
white-space: normal;
}
th {
background-color: #ccc;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
border-right: 1px solid #003d4c;
border-bottom: 1px solid #003d4c;
text-align: center;
padding:1px;
}
table tr td {
border-right: 1px solid #ccc;
padding:4px 4px;
vertical-align:top;
text-align: center;
}
table tr.altRow td {
background: #f4f4f4;
}
/* scaffold show */
div.related {
clear:both;
display:block;
}
dl {
line-height:2em;
margin:1em;
float:left;
width: 400px;
}
dt {
font-weight: bold;
vertical-align:top;
}
dd {
margin-left:10em;
margin-top:-2em;
vertical-align:top;
}
/* scaffold buttons */
.notice {
color: #DB8101;
background-color: #ddd;
display: block;
padding: 1em;
}
.tip {
color: #DB8101;
background-color: #ddd;
display: block;
padding: 1em;
}
/* action links */
ul.actions {
float:left;
margin-left: 10px;
width: 200px;
}

View file

@ -0,0 +1,279 @@
/* form.css */
form {
margin: 0 4px;
font-size: 120%;
border-width: 0px 0px 0px 0px;
border-style: solid;
border-color: #DB8101;
}
form fieldset {
font-size: 100%;
border-color: #000000;
border-width: 1px 0px 0px 0px;
border-style: solid none none none;
padding: 10px;
}
form fieldset legend {
font-size: 150%;
font-weight: normal;
color: #000;
padding: 0px 5px;
}
label {
font-size: 150%;
}
label u {
font-style: normal;
text-decoration: underline;
}
input, select, textarea {
font-family: Tahoma, Arial, sans-serif;
font-size: 100%;
color: #000;
}
textarea {
overflow: auto;
}
form div {
clear: left;
display: block;
margin: 5px 0px 0px 0px;
padding: 1px 3px;
}
form fieldset div.notes {
float: right;
width: 158px;
height: auto;
margin: 0px 0px 10px 10px;
padding: 5px;
border: 1px solid #666;
background-color: #ffffe1;
color: #666;
font-size: 88%;
}
form fieldset div.notes h4 {
background-image: url(/images/icon_info.gif);
background-repeat: no-repeat;
background-position: top left;
padding: 3px 0px 3px 27px;
border-width: 0px 0px 1px 0px;
border-style: solid;
border-color: #666;
color: #666;
font-size: 110%;
}
form fieldset div.notes p {
margin: 0em 0em 1.2em 0em;
color: #666;
}
form fieldset div.notes p.last {
margin: 0em;
}
form div fieldset {
clear: none;
border-width: 0px 1px 0px 1px;
border-style: solid;
border-color: #666;
margin: 0px 0px 0px 142px;
padding: 0px 5px 5px 5px;
}
form div fieldset legend {
font-size: 100%;
padding: 0px 3px 0px 9px;
}
form div.required fieldset legend {
font-weight: bold;
}
form div label {
display: block;
float: left;
width: 200px;
background-color: #f4f4f4;
font-size: 16px;
padding: 3px 5px;
margin: 0px 0px 5px 0px;
text-align: right;
}
form div.optional label, label.optional {
font-weight: normal;
}
form div.required label, label.required {
font-weight: bold;
}
form div label.labelCheckbox, form div label.labelRadio {
float: none;
display: block;
margin: 0px 0px 5px 142px;
text-align: left;
}
form div fieldset label.labelCheckbox, form div fieldset label.labelRadio {
margin: 0px 0px 5px 0px;
}
p.error {
color: #DB8101;
background-color: #DBA941;
font-size: 14px;
padding: 1em;
}
form div input, form div select, form div textarea {
padding: 1px 3px;
margin: 0px 0px 0px 0px;
}
form div input.inputFile {
width: 211px;
}
form div select.selectOne, form div select.selectMultiple {
width: 211px;
padding: 1px 3px;
}
form div input.inputCheckbox, form div input.inputRadio, input.inputCheckbox, input.inputRadio {
display: inline;
height: 14px;
width: 14px;
background-color: transparent;
border-width: 0px;
}
form div.submit {
padding: 0px 0px 0px 140px;
clear:both;
display:block;
}
div.submit input {
padding: 2px 12px;
color: #DB8101;
background-color:#ccc;
text-decoration: none;
border: 1px solid #666;
font-size: 14px;
font-weight: bold;
text-align:center;
text-decoration: none;
width: auto;
}
div.submit input:hover {
padding: 2px 12px;
color: #fff;
background-color:#DB8101;
text-decoration: none;
border: 1px solid #666;
font-size: 14px;
font-weight: bold;
text-align:center;
text-decoration: none;
width: auto;
}
form div.submit div input.inputSubmit, form div.submit div input.inputButton {
float: right;
margin: 0px 0px 0px 5px;
}
form div small {
display: block;
margin: 0px 0px 5px 142px;
padding: 1px 3px;
font-size: 88%;
}
/* form.import.css */
form fieldset legend {
line-height: 150%;
}
form input, form select, form textarea {
background-color: #fff;
}
div.optional label:before {
content: '';
}
div.required label:before {
content: '';
}
form div label.labelCheckbox, form div label.labelRadio, label.labelCheckbox, label.labelRadio {
display: block;
width: 190px;
padding: 4px 0px 0px 18px;
text-indent: -18px;
line-height: 120%;
}
form div label.labelCheckbox input.inputCheckbox, form div label.labelRadio input.inputRadio, label.labelCheckbox input.inputCheckbox, label.labelRadio input.inputRadio {
margin: 0;
}
form div fieldset input.inputText, form div fieldset input.inputPassword, form div fieldset input.inputFile, form div fieldset textarea.inputTextarea {
width: 160px;
margin: 0px 0px 0px 18px;
}
form div label.compact {
display: inline;
width: auto;
padding: 4px 10px 0px 0px;
text-indent: 0px;
margin: 0;
}
form div.wide label {
float: none;
display: block;
}
form div label.wide {
width: 348px;
}
form div.wide input.inputText, form div.wide input.inputPassword, form div.wide input.inputFile, form div.wide select, form div.wide textarea {
width: 344px;
margin: 0;
}
form div.notes p, form div small {
line-height: 125%;
}
form div.wide small {
margin: 0px 0px 5px 0px;
}
div.date select {
width:auto;
}
select.autoWidth {
width:auto;
}
option {
padding-left:1em;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -0,0 +1,114 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.webroot
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Do not change
*/
if (!defined('DS'))
{
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
* Each define has a commented line of code that explains what you would change.
*
*/
if (!defined('ROOT'))
{
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
//You should also use the DS define to seperate your directories
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
if (!defined('APP_DIR'))
{
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
define ('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
* This only needs to be changed if the cake installed libs are located
* outside of the distributed directory structure.
*/
if (!defined('CAKE_CORE_INCLUDE_PATH'))
{
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
//You should also use the DS define to seperate your directories
define('CAKE_CORE_INCLUDE_PATH', ROOT);
}
///////////////////////////////
//DO NOT EDIT BELOW THIS LINE//
///////////////////////////////
if (!defined('WEBROOT_DIR'))
{
define ('WEBROOT_DIR', basename(dirname(__FILE__)));
}
if (!defined('WWW_ROOT'))
{
define('WWW_ROOT', dirname(__FILE__).DS);
}
if(!defined('CORE_PATH'))
{
if(function_exists('ini_set'))
{
ini_set('include_path',ini_get('include_path').PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.PATH_SEPARATOR.ROOT.DS.APP_DIR.DS);
define('APP_PATH', null);
define('CORE_PATH', null);
}
else
{
define('APP_PATH', ROOT.DS.APP_DIR.DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH.DS);
}
}
require CORE_PATH.'cake'.DS.'bootstrap.php';
if(isset($_GET['url']) && $_GET['url'] === 'favicon.ico')
{
}
else
{
$Dispatcher= new Dispatcher ();
$Dispatcher->dispatch($url);
}
if (DEBUG)
{
echo "<!-- ". round(getMicrotime() - $TIME_START, 4) ."s -->";
}
?>

View file

@ -0,0 +1,40 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* This file includes js vendor-files from /vendor/ directory if they need to
* be accessible to the public.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.webroot.js
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/
if(is_file('../../vendors/javascript/'.$_GET['file']) && (preg_match('/(.+)\\.js/', $_GET['file'])))
{
readfile('../../vendors/javascript/'.$_GET['file']);
}
?>

View file

@ -0,0 +1,16 @@
<?php
$output = "<p style=\"background:#DBA941;padding:4px;font-size: 16px;\">Your database configuration file is <?php echo file_exists(CONFIGS.'database.php') ?' present.' . \$filePresent = ' ' : ' not present.'; ?></p>\n";
$output .= "<?php if (!empty(\$filePresent)):?>\n";
$output .= "<?php \$db = ConnectionManager::getInstance(); ?>\n";
$output .= "<?php \$connected = \$db->getDataSource('default'); ?>\n";
$output .= "<p style=\"background:#DBA941;padding:4px;font-size: 16px;\">Cake<?php echo \$connected->isConnected() ? ' is able to' : ' is not able to';?> connect to the database.</p>\n";
$output .= "<br />\n";
$output .= "<?php endif; ?>\n";
$output .= "<h1>CakePHP just \"Baked\" your application: ".Inflector::humanize($app)."</h1>\n";
$output .= "<h2>Editing this Page</h2>\n";
$output .= "<p>\n";
$output .= "To change the content of this page, edit: ".$dir.DS."views".DS."pages".DS."home.thtml.<br />\n";
$output .= "To change its layout, edit: ".$dir.DS."views".DS."layouts".DS."default.thtml.<br />\n";
$output .= "You can also add some CSS styles for your pages at: ".$dir.DS."webroot/css/.\n";
$output .= "</p>\n";
?>

View file

@ -37,7 +37,7 @@ define ('DS', DIRECTORY_SEPARATOR);
define ('ROOT', dirname(__FILE__));
define ('WEBROOT_DIR', 'webroot');
define('WWW_ROOT', ROOT.APP_DIR.DS.WEBROOT_DIR.DS);
define('WWW_ROOT', ROOT.DS.APP_DIR.DS.WEBROOT_DIR.DS);
/**
* This only needs to be changed if the cake installed libs are located
* outside of the distributed directory structure.