059a33b581989d92af85b9d11c3811518c58c50f

Author: skeemer

Date: 2009-01-05 15:58:20 -0800

Initial project files import

diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1451c79 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +tmp +tmp/* +config/database.php diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..0ed8662 --- /dev/null +++ b/.htaccess @@ -0,0 +1,5 @@ +<IfModule mod_rewrite.c> + RewriteEngine on + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + </IfModule> \ No newline at end of file diff --git a/config/acl.ini.php b/config/acl.ini.php new file mode 100644 index 0000000..6f74673 --- /dev/null +++ b/config/acl.ini.php @@ -0,0 +1,74 @@ +;<?php die() ?> +; SVN FILE: $Id: acl.ini.php 7945 2008-12-19 02:16:01Z gwoo $ +;/** +; * Short description for file. +; * +; * +; * PHP versions 4 and 5 +; * +; * CakePHP(tm) : Rapid Development Framework http://www.cakephp.org/ +; * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) +; * +; * Licensed under The MIT License +; * Redistributions of files must retain the above copyright notice. +; * +; * @filesource +; * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) +; * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project +; * @package cake +; * @subpackage cake.app.config +; * @since CakePHP(tm) v 0.10.0.1076 +; * @version $Revision: 7945 $ +; * @modifiedby $LastChangedBy: gwoo $ +; * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ +; * @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 \ No newline at end of file diff --git a/config/bootstrap.php b/config/bootstrap.php new file mode 100644 index 0000000..451ea47 --- /dev/null +++ b/config/bootstrap.php @@ -0,0 +1,44 @@ +<?php +/* SVN FILE: $Id: bootstrap.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * Short description for file. + * + * Long description for file + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config + * @since CakePHP(tm) v 0.10.8.2117 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @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 +?> \ No newline at end of file diff --git a/config/core.php b/config/core.php new file mode 100644 index 0000000..1f0a3f3 --- /dev/null +++ b/config/core.php @@ -0,0 +1,227 @@ +<?php +/* SVN FILE: $Id: core.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * This is core configuration file. + * + * Use it to configure core behavior of Cake. + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/** + * CakePHP Debug Level: + * + * Production Mode: + * 0: No error messages, errors, or warnings shown. Flash messages redirect. + * + * Development Mode: + * 1: Errors and warnings shown, model caches refreshed, flash messages halted. + * 2: As in 1, but also with full debug messages and SQL output. + * 3: As in 2, but also with full controller dump. + * + * In production mode, flash messages redirect after a time interval. + * In development mode, you need to click the flash message to continue. + */ + Configure::write('debug', 2); +/** + * Application wide charset encoding + */ + Configure::write('App.encoding', 'UTF-8'); +/** + * To configure CakePHP *not* to use mod_rewrite and to + * use CakePHP pretty URLs, remove these .htaccess + * files: + * + * /.htaccess + * /app/.htaccess + * /app/webroot/.htaccess + * + * And uncomment the App.baseUrl below: + */ + //Configure::write('App.baseUrl', env('SCRIPT_NAME')); +/** + * Uncomment the define below to use CakePHP admin routes. + * + * The value of the define determines the name of the route + * and its associated controller actions: + * + * 'admin' -> admin_index() and /admin/controller/index + * 'superuser' -> superuser_index() and /superuser/controller/index + */ + //Configure::write('Routing.admin', 'admin'); + +/** + * Turn off all caching application-wide. + * + */ + //Configure::write('Cache.disable', true); +/** + * Enable cache checking. + * + * If set to true, for view caching you must still use the controller + * var $cacheAction inside your controllers to define caching settings. + * You can either set it controller-wide by setting var $cacheAction = true, + * or in each action using $this->cacheAction = true. + * + */ + //Configure::write('Cache.check', true); +/** + * Defines the default error type when using the log() function. Used for + * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. + */ + define('LOG_ERROR', 2); +/** + * The preferred session handling method. Valid values: + * + * 'php' Uses settings defined in your php.ini. + * 'cake' Saves session files in CakePHP's /tmp directory. + * 'database' Uses CakePHP's database sessions. + * + * To define a custom session handler, save it at /app/config/<name>.php. + * Set the value of 'Session.save' to <name> to utilize it in CakePHP. + * + * To use database sessions, execute the SQL file found at /app/config/sql/sessions.sql. + * + */ + Configure::write('Session.save', 'php'); +/** + * The name of the table used to store CakePHP database sessions. + * + * 'Session.save' must be set to 'database' in order to utilize this constant. + * + * The table name set here should *not* include any table prefix defined elsewhere. + */ + //Configure::write('Session.table', 'cake_sessions'); +/** + * The DATABASE_CONFIG::$var to use for database session handling. + * + * 'Session.save' must be set to 'database' in order to utilize this constant. + */ + //Configure::write('Session.database', 'default'); +/** + * The name of CakePHP's session cookie. + */ + Configure::write('Session.cookie', 'CAKEPHP'); +/** + * Session time out time (in seconds). + * Actual value depends on 'Security.level' setting. + */ + Configure::write('Session.timeout', '120'); +/** + * If set to false, sessions are not automatically started. + */ + Configure::write('Session.start', true); +/** + * When set to false, HTTP_USER_AGENT will not be checked + * in the session + */ + Configure::write('Session.checkAgent', true); +/** + * The level of CakePHP security. The session timeout time defined + * in 'Session.timeout' is multiplied according to the settings here. + * Valid values: + * + * 'high' Session timeout in 'Session.timeout' x 10 + * 'medium' Session timeout in 'Session.timeout' x 100 + * 'low' Session timeout in 'Session.timeout' x 300 + * + * CakePHP session IDs are also regenerated between requests if + * 'Security.level' is set to 'high'. + */ + Configure::write('Security.level', 'high'); +/** + * A random string used in security hashing methods. + */ + Configure::write('Security.salt', 'DYhG93bfjfjYJDKRJjwio73184vniR2G0FgaC9mi'); +/** + * Compress CSS output by removing comments, whitespace, repeating tags, etc. + * This requires a/var/cache directory to be writable by the web server for caching. + * and /vendors/csspp/csspp.php + * + * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). + */ + //Configure::write('Asset.filter.css', 'css.php'); +/** + * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the + * output, and setting the config below to the name of the script. + * + * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). + */ + //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); +/** + * The classname and database used in CakePHP's + * access control lists. + */ + Configure::write('Acl.classname', 'DbAcl'); + Configure::write('Acl.database', 'default'); +/** + * + * Cache Engine Configuration + * Default settings provided below + * + * File storage engine. + * + * Cache::config('default', array( + * 'engine' => 'File', //[required] + * 'duration'=> 3600, //[optional] + * 'probability'=> 100, //[optional] + * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path + * 'prefix' => 'cake_', //[optional] prefix every cache file with this string + * 'lock' => false, //[optional] use file locking + * 'serialize' => true, [optional] + * )); + * + * + * APC (http://pecl.php.net/package/APC) + * + * Cache::config('default', array( + * 'engine' => 'Apc', //[required] + * 'duration'=> 3600, //[optional] + * 'probability'=> 100, //[optional] + * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string + * )); + * + * Xcache (http://xcache.lighttpd.net/) + * + * Cache::config('default', array( + * 'engine' => 'Xcache', //[required] + * 'duration'=> 3600, //[optional] + * 'probability'=> 100, //[optional] + * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string + * 'user' => 'user', //user from xcache.admin.user settings + * 'password' => 'password', //plaintext password (xcache.admin.pass) + * )); + * + * + * Memcache (http://www.danga.com/memcached/) + * + * Cache::config('default', array( + * 'engine' => 'Memcache', //[required] + * 'duration'=> 3600, //[optional] + * 'probability'=> 100, //[optional] + * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string + * 'servers' => array( + * '127.0.0.1:11211' // localhost, default port 11211 + * ), //[optional] + * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) + * )); + * + */ + Cache::config('default', array('engine' => 'File')); +?> \ No newline at end of file diff --git a/config/database.php.default b/config/database.php.default new file mode 100644 index 0000000..ef5aa08 --- /dev/null +++ b/config/database.php.default @@ -0,0 +1,101 @@ +<?php +/* SVN FILE: $Id: database.php.default 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * This is core configuration file. + * + * Use it to configure core behaviour ofCake. + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @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 => The name of a supported driver; valid options are as follows: + * mysql - MySQL 4 & 5, + * mysqli - MySQL 4 & 5 Improved Interface (PHP5 only), + * sqlite - SQLite (PHP5 only), + * postgres - PostgreSQL 7 and higher, + * mssql - Microsoft SQL Server 2000 and higher, + * db2 - IBM DB2, Cloudscape, and Apache Derby (http://php.net/ibm-db2) + * oracle - Oracle 8 and higher + * firebird - Firebird/Interbase + * sybase - Sybase ASE + * adodb-[drivername] - ADOdb interface wrapper (see below), + * odbc - ODBC DBO driver + * + * You can add custom database drivers (or override existing drivers) by adding the + * appropriate file to app/models/datasources/dbo. Drivers should be named 'dbo_x.php', + * where 'x' is the name of the database. + * + * persistent => true / false + * Determines whether or not the database should use a persistent connection + * + * connect => + * 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) + * For all other databases, this setting is deprecated. + * + * host => + * the host you connect to the database. To add a socket or port number, use 'port' => # + * + * prefix => + * Uses the given prefix for all the tables in this database. This setting can be overridden + * on a per-table basis with the Model::$tablePrefix property. + * + * schema => + * For Postgres and DB2, specifies which schema you would like to use the tables in. Postgres defaults to + * 'public', DB2 defaults to empty. + * + * encoding => + * For MySQL, MySQLi, Postgres and DB2, specifies the character encoding to use when connecting to the + * database. Defaults to 'UTF-8' for DB2. Uses database default for all others. + * + */ +class DATABASE_CONFIG { + + var $default = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'database_name', + 'prefix' => '', + ); + + var $test = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'test_database_name', + 'prefix' => '', + ); +} +?> \ No newline at end of file diff --git a/config/inflections.php b/config/inflections.php new file mode 100644 index 0000000..7670f39 --- /dev/null +++ b/config/inflections.php @@ -0,0 +1,70 @@ +<?php +/* SVN FILE: $Id: inflections.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * 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(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config + * @since CakePHP(tm) v 1.0.0.2312 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @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); +?> \ No newline at end of file diff --git a/config/routes.php b/config/routes.php new file mode 100644 index 0000000..8e97f9b --- /dev/null +++ b/config/routes.php @@ -0,0 +1,39 @@ +<?php +/* SVN FILE: $Id: routes.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * 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(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @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.ctp)... + */ + Router::connect ('/', array('controller' => 'posts', 'action' => 'index')); +/** + * ...and connect the rest of 'Pages' controller's urls. + */ + Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); +?> \ No newline at end of file diff --git a/config/sql/db_acl.php b/config/sql/db_acl.php new file mode 100644 index 0000000..d0de5bf --- /dev/null +++ b/config/sql/db_acl.php @@ -0,0 +1,79 @@ +<?php +/* SVN FILE: $Id: db_acl.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/*DbAcl schema generated on: 2007-11-24 15:11:13 : 1195945453*/ +/** + * This is Acl Schema file + * + * Use it to configure database for ACL + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config.sql + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/* + * + * Using the Schema command line utility + * cake schema run create DbAcl + * + */ +class DbAclSchema extends CakeSchema { + + var $name = 'DbAcl'; + + function before($event = array()) { + return true; + } + + function after($event = array()) { + } + + var $acos = array( + 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'), + 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'model' => array('type'=>'string', 'null' => true), + 'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'alias' => array('type'=>'string', 'null' => true), + 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + + var $aros = array( + 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'), + 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'model' => array('type'=>'string', 'null' => true), + 'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'alias' => array('type'=>'string', 'null' => true), + 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + + var $aros_acos = array( + 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'), + 'aro_id' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'), + 'aco_id' => array('type'=>'integer', 'null' => false, 'length' => 10), + '_create' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2), + '_read' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2), + '_update' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2), + '_delete' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1)) + ); + +} +?> \ No newline at end of file diff --git a/config/sql/db_acl.sql b/config/sql/db_acl.sql new file mode 100644 index 0000000..080f06c --- /dev/null +++ b/config/sql/db_acl.sql @@ -0,0 +1,40 @@ +# $Id: db_acl.sql 7945 2008-12-19 02:16:01Z gwoo $ +# +# Copyright 2005-2008, Cake Software Foundation, Inc. +# +# Licensed under The MIT License +# Redistributions of files must retain the above copyright notice. +# http://www.opensource.org/licenses/mit-license.php The MIT License + +CREATE TABLE acos ( + id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, + parent_id INTEGER(10) DEFAULT NULL, + model VARCHAR(255) DEFAULT '', + foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, + alias VARCHAR(255) DEFAULT '', + lft INTEGER(10) DEFAULT NULL, + rght INTEGER(10) DEFAULT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE aros_acos ( + id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, + aro_id INTEGER(10) UNSIGNED NOT NULL, + aco_id INTEGER(10) UNSIGNED NOT NULL, + _create CHAR(2) NOT NULL DEFAULT 0, + _read CHAR(2) NOT NULL DEFAULT 0, + _update CHAR(2) NOT NULL DEFAULT 0, + _delete CHAR(2) NOT NULL DEFAULT 0, + PRIMARY KEY(id) +); + +CREATE TABLE aros ( + id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, + parent_id INTEGER(10) DEFAULT NULL, + model VARCHAR(255) DEFAULT '', + foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, + alias VARCHAR(255) DEFAULT '', + lft INTEGER(10) DEFAULT NULL, + rght INTEGER(10) DEFAULT NULL, + PRIMARY KEY (id) +); diff --git a/config/sql/i18n.php b/config/sql/i18n.php new file mode 100644 index 0000000..83e6bdf --- /dev/null +++ b/config/sql/i18n.php @@ -0,0 +1,56 @@ +<?php +/* SVN FILE: $Id: i18n.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/*i18n schema generated on: 2007-11-25 07:11:25 : 1196004805*/ +/** + * This is i18n Schema file + * + * Use it to configure database for i18n + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config.sql + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/* + * + * Using the Schema command line utility + * cake schema run create i18n + * + */ +class i18nSchema extends CakeSchema { + + var $name = 'i18n'; + + function before($event = array()) { + return true; + } + + function after($event = array()) { + } + + var $i18n = array( + 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'), + 'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'), + 'model' => array('type'=>'string', 'null' => false, 'key' => 'index'), + 'foreign_key' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'), + 'field' => array('type'=>'string', 'null' => false, 'key' => 'index'), + 'content' => array('type'=>'text', 'null' => true, 'default' => NULL), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0)) + ); + +} +?> \ No newline at end of file diff --git a/config/sql/i18n.sql b/config/sql/i18n.sql new file mode 100644 index 0000000..4660a5a --- /dev/null +++ b/config/sql/i18n.sql @@ -0,0 +1,26 @@ +# $Id: i18n.sql 7945 2008-12-19 02:16:01Z gwoo $ +# +# Copyright 2005-2008, Cake Software Foundation, Inc. +# +# Licensed under The MIT License +# Redistributions of files must retain the above copyright notice. +# http://www.opensource.org/licenses/mit-license.php The MIT License + +CREATE TABLE i18n ( + id int(10) NOT NULL auto_increment, + locale varchar(6) NOT NULL, + model varchar(255) NOT NULL, + foreign_key int(10) NOT NULL, + field varchar(255) NOT NULL, + content mediumtext, + PRIMARY KEY (id), +# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field), +# INDEX I18N_LOCALE_ROW(locale, model, foreign_key), +# INDEX I18N_LOCALE_MODEL(locale, model), +# INDEX I18N_FIELD(model, foreign_key, field), +# INDEX I18N_ROW(model, foreign_key), + INDEX locale (locale), + INDEX model (model), + INDEX row_id (foreign_key), + INDEX field (field) +); diff --git a/config/sql/sessions.php b/config/sql/sessions.php new file mode 100644 index 0000000..dd60eba --- /dev/null +++ b/config/sql/sessions.php @@ -0,0 +1,53 @@ +<?php +/* SVN FILE: $Id: sessions.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/*Sessions schema generated on: 2007-11-25 07:11:54 : 1196004714*/ +/** + * This is Sessions Schema file + * + * Use it to configure database for Sessions + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.config.sql + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/* + * + * Using the Schema command line utility + * cake schema run create Sessions + * + */ +class SessionsSchema extends CakeSchema { + + var $name = 'Sessions'; + + function before($event = array()) { + return true; + } + + function after($event = array()) { + } + + var $cake_sessions = array( + 'id' => array('type'=>'string', 'null' => false, 'key' => 'primary'), + 'data' => array('type'=>'text', 'null' => true, 'default' => NULL), + 'expires' => array('type'=>'integer', 'null' => true, 'default' => NULL), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + +} +?> \ No newline at end of file diff --git a/config/sql/sessions.sql b/config/sql/sessions.sql new file mode 100644 index 0000000..23a1925 --- /dev/null +++ b/config/sql/sessions.sql @@ -0,0 +1,16 @@ +# $Id: sessions.sql 7118 2008-06-04 20:49:29Z gwoo $ +# +# Copyright 2005-2008, 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. +# http://www.opensource.org/licenses/mit-license.php The MIT License + +CREATE TABLE cake_sessions ( + id varchar(255) NOT NULL default '', + data text, + expires int(11) default NULL, + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/controllers/ac.php b/controllers/ac.php new file mode 100644 index 0000000..13a493e --- /dev/null +++ b/controllers/ac.php @@ -0,0 +1,137 @@ +<?php + +class AppController extends Controller { + /** + * components + * + * Array of components to load for every controller in the application + * + * @var $components array + * @access public + */ + var $components = array('Auth'); + /** + * beforeFilter + * + * Application hook which runs prior to each controller action + * + * @access public + */ + function beforeFilter(){ + $this->log('Entering beforeFilter()', LOG_DEBUG); + $this->log('URL:'.$_SERVER['REQUEST_URI'], LOG_DEBUG); + //Override default fields used by Auth component + $this->Auth->fields = array('username'=>'email_address','password'=>'password'); + //Set application wide actions which do not require authentication + $this->Auth->allow('index'); + $this->Auth->allow('view'); + //Set the default redirect for users who logout + $this->Auth->logoutRedirect = '/'; + //Set the default redirect for users who login + $this->Auth->loginRedirect = '/'; + //Extend auth component to include authorisation via isAuthorized action + $this->Auth->authorize = 'controller'; + //Restrict access to only users with an active account + $this->Auth->userScope = array('User.active = 1'); + //Pass auth component data over to view files + $this->set('Auth',$this->Auth->user()); + } + /** + * beforeRender + * + * Application hook which runs after each action but, before the view file is + * rendered + * + * @access public + */ + function beforeRender(){ + //If we have an authorised user logged then pass over an array of controllers + //to which they have index action permission + if($this->Auth->user()){ + $controllerList = Configure::listObjects('controller'); + $permittedControllers = array(); + foreach($controllerList as $controllerItem){ + if($controllerItem <> 'App'){ + if($this->__permitted($controllerItem,'index')){ + $permittedControllers[] = $controllerItem; + } + } + } + } + $this->set(compact('permittedControllers')); + } + /** + * isAuthorized + * + * Called by Auth component for establishing whether the current authenticated + * user has authorization to access the current controller:action + * + * @return true if authorised/false if not authorized + * @access public + */ + function isAuthorized(){ + $this->log('Permissions checking requested', LOG_DEBUG); + return $this->__permitted($this->name,$this->action); + } + /** + * __permitted + * + * Helper function returns true if the currently authenticated user has permission + * to access the controller:action specified by $controllerName:$actionName + * @return + * @param $controllerName Object + * @param $actionName Object + */ + function __permitted($controllerName,$actionName){ + //Ensure checks are all made lower case + $controllerName = low($controllerName); + $actionName = low($actionName); + + $this->log('_loggedIn='.$this->Auth->user('id'), LOG_DEBUG); + if(!$this->Auth->user('id')) { + $this->log('Permissions checking without logged-in user', LOG_DEBUG); + return false; + } + + //If permissions have not been cached to session... + if(!$this->Session->check('Permissions')){ + //...then build permissions array and cache it + $permissions = array(); + //everyone gets permission to logout + $permissions[]='users:logout'; + //Import the User Model so we can build up the permission cache + App::import('Model', 'User'); + $thisUser = new User; + //Now bring in the current users full record along with groups + $thisGroups = $thisUser->find(array('User.id'=>$this->Auth->user('id'))); + $thisGroups = $thisGroups['Group']; + foreach($thisGroups as $thisGroup){ + $thisPermissions = $thisUser->Group->find(array('Group.id'=>$thisGroup['id'])); + $thisPermissions = $thisPermissions['Permission']; + foreach($thisPermissions as $thisPermission){ + $permissions[]=$thisPermission['name']; + } + } + //write the permissions array to session + $this->Session->write('Permissions',$permissions); + }else{ + //...they have been cached already, so retrieve them + $permissions = $this->Session->read('Permissions'); + } + //Now iterate through permissions for a positive match + foreach($permissions as $permission){ + if($permission == '*'){ + return true;//Super Admin Bypass Found + } + if($permission == $controllerName.':*'){ + return true;//Controller Wide Bypass Found + } + if($permission == $controllerName.':'.$actionName){ + return true;//Specific permission found + } + } + return false; + } +} + +?> \ No newline at end of file diff --git a/controllers/app_controller.php b/controllers/app_controller.php new file mode 100644 index 0000000..69f6316 --- /dev/null +++ b/controllers/app_controller.php @@ -0,0 +1,161 @@ +<?php +/** + * Short description for file. + * + * This file is the application-wide controller file. + * + * @package default + * @author Leo Lutz + * @date $LastChangedDate$ + * @version $Rev$ + **/ + +class AppController extends Controller { + /** + * components + * + * Array of components to load for every controller in the application + * + * @var $components array + * @access public + */ + var $components = array('Auth'); + + var $uses = array('Setting'); + /** + * beforeFilter + * + * Application hook which runs prior to each controller action + * + * @access public + */ + function beforeFilter(){ + //Reads the site-wide config values from the DB and puts them through the Configure::write method + $this->Setting->getcfg(); + + //Override default fields used by Auth component + $this->Auth->fields = array('username'=>'email_address','password'=>'password'); + //Set application wide actions which do not require authentication + $this->Auth->allow('index'); + $this->Auth->allow('view'); + //Set the default redirect for users who logout + $this->Auth->logoutRedirect = '/'; + //Set the default redirect for users who login + $this->Auth->loginRedirect = '/'; + //Extend auth component to include authorisation via isAuthorized action + $this->Auth->authorize = 'controller'; + //Restrict access to only users with an active account + $this->Auth->userScope = array('User.active = 1'); + //Pass auth component data over to view files + $this->set('Auth',$this->Auth->user()); + } + /** + * afterFilter + * + * Application hook which runs after each controller action + * + * @access public + */ + function afterFilter(){ + //Retrieves the site-wide configurations from Configure::read($key) and puts it back into the db if new + $this->Setting->writecfg(); + } + /** + * beforeRender + * + * Application hook which runs after each action but, before the view file is + * rendered + * + * @access public + */ + function beforeRender(){ + //If we have an authorised user logged then pass over an array of controllers + //to which they have index action permission + if($this->Auth->user()){ + $controllerList = Configure::listObjects('controller'); + $permittedControllers = array(); + foreach($controllerList as $controllerItem){ + if($controllerItem <> 'App'){ + if($this->__permitted($controllerItem,'index')){ + $permittedControllers[] = $controllerItem; + } + } + } + } + $this->set(compact('permittedControllers')); + } + /** + * isAuthorized + * + * Called by Auth component for establishing whether the current authenticated + * user has authorization to access the current controller:action + * + * @return true if authorised/false if not authorized + * @access public + */ + function isAuthorized(){ + $this->log('Permissions checking requested', LOG_DEBUG); + return $this->__permitted($this->name,$this->action); + } + /** + * __permitted + * + * Helper function returns true if the currently authenticated user has permission + * to access the controller:action specified by $controllerName:$actionName + * @return + * @param $controllerName Object + * @param $actionName Object + */ + function __permitted($controllerName,$actionName){ + //Ensure checks are all made lower case + $controllerName = low($controllerName); + $actionName = low($actionName); + + $this->log('_loggedIn='.$this->Auth->user('id'), LOG_DEBUG); + if(!$this->Auth->user('id')) { + $this->log('Permissions checking without logged-in user', LOG_DEBUG); + return false; + } + + //If permissions have not been cached to session... + if(!$this->Session->check('Permissions')){ + //...then build permissions array and cache it + $permissions = array(); + //everyone gets permission to logout + $permissions[]='users:logout'; + //Import the User Model so we can build up the permission cache + App::import('Model', 'User'); + $thisUser = new User; + //Now bring in the current users full record along with groups + $thisGroups = $thisUser->find(array('User.id'=>$this->Auth->user('id'))); + $thisGroups = $thisGroups['Group']; + foreach($thisGroups as $thisGroup){ + $thisPermissions = $thisUser->Group->find(array('Group.id'=>$thisGroup['id'])); + $thisPermissions = $thisPermissions['Permission']; + foreach($thisPermissions as $thisPermission){ + $permissions[]=$thisPermission['name']; + } + } + //write the permissions array to session + $this->Session->write('Permissions',$permissions); + }else{ + //...they have been cached already, so retrieve them + $permissions = $this->Session->read('Permissions'); + } + //Now iterate through permissions for a positive match + foreach($permissions as $permission){ + if($permission == '*'){ + return true;//Super Admin Bypass Found + } + if($permission == $controllerName.':*'){ + return true;//Controller Wide Bypass Found + } + if($permission == $controllerName.':'.$actionName){ + return true;//Specific permission found + } + } + return false; + } +} + +?> \ No newline at end of file diff --git a/controllers/components/empty b/controllers/components/empty new file mode 100644 index 0000000..e69de29 diff --git a/controllers/galleries_controller.php b/controllers/galleries_controller.php new file mode 100644 index 0000000..829495d --- /dev/null +++ b/controllers/galleries_controller.php @@ -0,0 +1,66 @@ +<?php +class GalleriesController extends AppController { + + var $name = 'Galleries'; + var $helpers = array('Html', 'Form'); + + function index() { + $this->Gallery->recursive = 0; + $this->set('galleries', $this->paginate()); + } + + function view($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid Gallery.', true)); + $this->redirect(array('action'=>'index')); + } + $this->set('gallery', $this->Gallery->read(null, $id)); + } + + function add() { + if (!empty($this->data)) { + $this->Gallery->create(); + if ($this->Gallery->save($this->data)) { + $this->Session->setFlash(__('The Gallery has been saved', true)); + $this->redirect(array('action'=>'index')); + } else { + $this->Session->setFlash(__('The Gallery could not be saved. Please, try again.', true)); + } + } else { + $this->set('galleriesList', $this->Gallery->generateTreeList(null, null, null, '--')); + } + } + + function edit($id = null) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(__('Invalid Gallery', true)); + $this->redirect(array('action'=>'index')); + } + if (!empty($this->data)) { + if ($this->Gallery->save($this->data)) { + $this->Session->setFlash(__('The Gallery has been saved', true)); + $this->redirect(array('action'=>'index')); + } else { + $this->Session->setFlash(__('The Gallery could not be saved. Please, try again.', true)); + $this->set('galleriesList', $this->Gallery->generateTreeList(null, null, null, '--')); + } + } + if (empty($this->data)) { + $this->data = $this->Gallery->read(null, $id); + $this->set('galleriesList', $this->Gallery->generateTreeList(null, null, null, '--')); + } + } + + function delete($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid id for Gallery', true)); + $this->redirect(array('action'=>'index')); + } + if ($this->Gallery->del($id)) { + $this->Session->setFlash(__('Gallery deleted', true)); + $this->redirect(array('action'=>'index')); + } + } + +} +?> \ No newline at end of file diff --git a/controllers/groups_controller.php b/controllers/groups_controller.php new file mode 100644 index 0000000..5003850 --- /dev/null +++ b/controllers/groups_controller.php @@ -0,0 +1,8 @@ +<?php + +class GroupsController extends AppController { + var $name = 'Groups'; + var $scaffold; +} + +?> \ No newline at end of file diff --git a/controllers/homepage_controller.php b/controllers/homepage_controller.php new file mode 100644 index 0000000..98306ec --- /dev/null +++ b/controllers/homepage_controller.php @@ -0,0 +1,10 @@ +<?php +class HomepageController extends AppController { + + var $name = 'Homepage'; + + function index_public() { + + } +} +?> \ No newline at end of file diff --git a/controllers/permissions_controller.php b/controllers/permissions_controller.php new file mode 100644 index 0000000..dad97cf --- /dev/null +++ b/controllers/permissions_controller.php @@ -0,0 +1,8 @@ +<?php + +class PermissionsController extends AppController { + var $name = 'Permissions'; + var $scaffold; +} + +?> \ No newline at end of file diff --git a/controllers/posts_controller.php b/controllers/posts_controller.php new file mode 100644 index 0000000..1e998f3 --- /dev/null +++ b/controllers/posts_controller.php @@ -0,0 +1,41 @@ +<?php +class PostsController extends AppController { + + //var $name = 'Posts'; + + function index() { + $this->set('posts', $this->Post->find('all')); + } + + function view($id = null) { + $this->Post->id = $id; + $this->set('post', $this->Post->read()); + } + + function add() { + if (!empty($this->data)) { + if ($this->Post->save($this->data)) { + $this->flash('Your post has been saved.', '/posts'); + } + } + } + + function delete($id) { + $this->Post->del($id); + $this->flash('The post with id: '.$id.' has been deleted.', '/posts'); + } + + function edit($id = null) { + $this->Post->id = $id; + if (empty($this->data)) { + $this->data = $this->Post->read(); + } else { + if ($this->Post->save($this->data)) { + $this->flash('Your post has been updated.','/posts'); + } + } + } + +} + +?> \ No newline at end of file diff --git a/controllers/users_controller.php b/controllers/users_controller.php new file mode 100644 index 0000000..8b9635e --- /dev/null +++ b/controllers/users_controller.php @@ -0,0 +1,13 @@ +<?php + +class UsersController extends AppController { + var $name = 'Users'; + var $scaffold; + function login(){} + function logout(){ + $this->Session->del('Permissions'); + $this->redirect($this->Auth->logout()); + } +} + +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..96da0f0 --- /dev/null +++ b/index.php @@ -0,0 +1,24 @@ +<?php +/* SVN FILE: $Id: index.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app + * @since CakePHP(tm) v 0.10.0.1076 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +require 'webroot' . DIRECTORY_SEPARATOR . 'index.php'; +?> \ No newline at end of file diff --git a/locale/eng/LC_MESSAGES/empty b/locale/eng/LC_MESSAGES/empty new file mode 100644 index 0000000..e69de29 diff --git a/models/behaviors/empty b/models/behaviors/empty new file mode 100644 index 0000000..e69de29 diff --git a/models/datasources/empty b/models/datasources/empty new file mode 100644 index 0000000..e69de29 diff --git a/models/gallery.php b/models/gallery.php new file mode 100644 index 0000000..d54b99f --- /dev/null +++ b/models/gallery.php @@ -0,0 +1,41 @@ +<?php +class Gallery extends AppModel { + + var $name = 'Gallery'; + var $validate = array( + 'title' => array('alphanumeric'), + 'description' => array('alphanumeric'), + 'date' => array('date') + ); + + var $hasOne = array( + 'Highlight' => array('className' => 'Photo', + 'foreignKey' => 'gallery_id', + 'dependent' => false, + 'conditions' => '', + 'fields' => '', + 'order' => '' + ) + ); + + var $hasMany = array( + 'Photo' => array('className' => 'Photo', + 'foreignKey' => 'gallery_id', + 'dependent' => false, + 'conditions' => '', + 'fields' => '', + 'order' => '', + 'limit' => '', + 'offset' => '', + 'exclusive' => '', + 'finderQuery' => '', + 'counterQuery' => '' + ) + ); + + function beforeSave() { + unset($this->data['Gallery']['created']); + } + +} +?> \ No newline at end of file diff --git a/models/group.php b/models/group.php new file mode 100644 index 0000000..3852cdd --- /dev/null +++ b/models/group.php @@ -0,0 +1,21 @@ +<?php + +class Group extends AppModel { + var $name = 'Group'; + var $hasAndBelongsToMany = array( + 'Permission' => array('className' => 'Permission', + 'joinTable' => 'groups_permissions', + 'foreignKey' => 'group_id', + 'associationForeignKey' => 'permission_id', + 'unique' => true + ), + 'User' => array('className' => 'User', + 'joinTable' => 'groups_users', + 'foreignKey' => 'group_id', + 'associationForeignKey' => 'user_id', + 'unique' => true + ) + ); +} + +?> \ No newline at end of file diff --git a/models/permission.php b/models/permission.php new file mode 100644 index 0000000..b5ee438 --- /dev/null +++ b/models/permission.php @@ -0,0 +1,15 @@ +<?php + +class Permission extends AppModel { + var $name = 'Permission'; + var $hasAndBelongsToMany = array( + 'Group' => array('className' => 'Group', + 'joinTable' => 'groups_permissions', + 'foreignKey' => 'permission_id', + 'associationForeignKey' => 'group_id', + 'unique' => true + ) + ); +} + +?> \ No newline at end of file diff --git a/models/photo.php b/models/photo.php new file mode 100644 index 0000000..655b51a --- /dev/null +++ b/models/photo.php @@ -0,0 +1,34 @@ +<?php +class Photo extends AppModel { + + var $name = 'Photo'; + var $validate = array( + 'title' => array('alphanumeric'), + 'caption' => array('alphanumeric'), + 'approval_date' => array('date'), + 'filename' => array('alphanumeric'), + 'filetype' => array('alphanumeric') + ); + + //The Associations below have been created with all possible keys, those that are not needed can be removed + var $belongsTo = array( + 'Gallery' => array('className' => 'Gallery', + 'foreignKey' => 'gallery_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ), + 'User' => array('className' => 'User', + 'foreignKey' => 'user_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ) + ); + + function beforeSave() { + unset($this->data['Photo']['created']); + } + +} +?> \ No newline at end of file diff --git a/models/post.php b/models/post.php new file mode 100644 index 0000000..425d44c --- /dev/null +++ b/models/post.php @@ -0,0 +1,16 @@ +<?php + +class Post extends AppModel { + var $name = 'Post'; + + var $validate = array( + 'title' => array( + 'rule' => array('minLength', 1) + ), + 'body' => array( + 'rule' => array('minLength', 1) + ) + ); +} + +?> \ No newline at end of file diff --git a/models/setting.php b/models/setting.php new file mode 100644 index 0000000..55403d3 --- /dev/null +++ b/models/setting.php @@ -0,0 +1,42 @@ +<?php +class Setting extends AppModel { + + var $name = 'Setting'; + var $key = 'FS'; + + //retrieve configuration data from the DB + function getcfg(){ + $key=$this->key; + $cfgs = $this->find('first',array('fields'=>array('id','key','value'))); + + if (count($cfgs)) { + $this->checksum=$cfgs['Setting']['value']; + $cfgVal = unserialize($cfgs['Setting']['value']); + + } + Configure::write($key,$cfgVal); + } + + //write configuration data back to the DB + function writecfg(){ + $key = $this->key; + + $rev = Configure::read($key); + + $value=serialize($rev); + + //if the configs haven't changed, no need to save them + if ($value==$this->checksum) return; + + //otherwise the configs have changed, so + + $this->data = array('key'=>$key,'value'=>$value); + + if ($setting = $this->findByKey($key)) { + $this->data['id'] = $setting['Setting']['id']; + } + + $this->save($this->data); + } +} +?> \ No newline at end of file diff --git a/models/user.php b/models/user.php new file mode 100644 index 0000000..9de5122 --- /dev/null +++ b/models/user.php @@ -0,0 +1,21 @@ +<?php + +class User extends AppModel { + var $displayField = 'email_address'; + var $name = 'User'; + var $validate = array( + 'email_address' => array('email'), + 'password' => array('alphaNumeric'), + 'active' => array('numeric') + ); + var $hasAndBelongsToMany = array( + 'Group' => array('className' => 'Group', + 'joinTable' => 'groups_users', + 'foreignKey' => 'user_id', + 'associationForeignKey' => 'group_id', + 'unique' => true + ) + ); +} + +?> \ No newline at end of file diff --git a/plugins/empty b/plugins/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/behaviors/empty b/tests/cases/behaviors/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/components/empty b/tests/cases/components/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/controllers/empty b/tests/cases/controllers/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/controllers/galleries_controller.test.php b/tests/cases/controllers/galleries_controller.test.php new file mode 100644 index 0000000..793b37a --- /dev/null +++ b/tests/cases/controllers/galleries_controller.test.php @@ -0,0 +1,26 @@ +<?php +/* SVN FILE: $Id$ */ +/* GalleriesController Test cases generated on: 2008-12-31 03:12:10 : 1230721930*/ +App::import('Controller', 'Galleries'); + +class TestGalleries extends GalleriesController { + var $autoRender = false; +} + +class GalleriesControllerTest extends CakeTestCase { + var $Galleries = null; + + function setUp() { + $this->Galleries = new TestGalleries(); + $this->Galleries->constructClasses(); + } + + function testGalleriesControllerInstance() { + $this->assertTrue(is_a($this->Galleries, 'GalleriesController')); + } + + function tearDown() { + unset($this->Galleries); + } +} +?> \ No newline at end of file diff --git a/tests/cases/helpers/empty b/tests/cases/helpers/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/helpers/smarty_html.test.php b/tests/cases/helpers/smarty_html.test.php new file mode 100644 index 0000000..f7682e3 --- /dev/null +++ b/tests/cases/helpers/smarty_html.test.php @@ -0,0 +1,836 @@ +<?php +/* SVN FILE: $Id: html.test.php 7850 2008-11-08 12:34:51Z mariano.iglesias $ */ +/** + * Short description for file. + * + * Long description for file + * + * PHP versions 4 and 5 + * + * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite> + * Copyright 2006-2008, Cake Software Foundation, Inc. + * + * Licensed under The Open Group Test Suite License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. + * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests + * @package cake.tests + * @subpackage cake.tests.cases.libs.view.helpers + * @since CakePHP(tm) v 1.2.0.4206 + * @version $Revision: 7850 $ + * @modifiedby $LastChangedBy: mariano.iglesias $ + * @lastmodified $Date: 2008-11-08 06:34:51 -0600 (Sat, 08 Nov 2008) $ + * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License + */ +App::import('Core', array('Helper', 'AppHelper', 'ClassRegistry', 'Controller', 'Model')); +App::import('Helper', array('SmartyHtml', 'Form')); +/** + * TheHtmlTestController class + * + * @package cake + * @subpackage cake.tests.cases.libs.view.helpers + */ +class TheHtmlTestController extends Controller { +/** + * name property + * + * @var string 'TheTest' + * @access public + */ + var $name = 'TheTest'; +/** + * uses property + * + * @var mixed null + * @access public + */ + var $uses = null; +} +/** + * HtmlHelperTest class + * + * @package cake + * @subpackage cake.tests.cases.libs.view.helpers + */ +class SmartyHtmlHelperTest extends CakeTestCase { +/** + * html property + * + * @var mixed null + * @access public + */ + var $html = null; +/** + * setUp method + * + * @access public + * @return void + */ + function setUp() { + $this->Html =& new SmartyHtmlHelper(); + $view =& new View(new TheHtmlTestController()); + ClassRegistry::addObject('view', $view); + } +/** + * testDocType method + * + * @access public + * @return void + */ + function testDocType() { + $result = $this->Html->docType(); + $expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; + $this->assertEqual($result, $expected); + + $result = $this->Html->docType('html4-strict'); + $expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; + $this->assertEqual($result, $expected); + + $this->assertNull($this->Html->docType('non-existing-doctype')); + } +/** + * testLink method + * + * @access public + * @return void + */ + function testLink() { + $result = $this->Html->link('/home'); + $expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a'); + $this->assertTags($result, $expected); + + $result = $this->Html->link('Home', '/home', array('confirm' => 'Are you sure you want to do this?')); + $expected = array( + 'a' => array('href' => '/home', 'onclick' => 'return confirm(&#039;Are you sure you want to do this?&#039;);'), + 'Home', + '/a' + ); + $this->assertTags($result, $expected, true); + + $result = $this->Html->link('Home', '/home', array('default' => false)); + $expected = array( + 'a' => array('href' => '/home', 'onclick' => 'event.returnValue = false; return false;'), + 'Home', + '/a' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->link('Next >', '#'); + $expected = array( + 'a' => array('href' => '#'), + 'Next &gt;', + '/a' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->link('Next >', '#', array('escape' => true)); + $expected = array( + 'a' => array('href' => '#'), + 'Next &gt;', + '/a' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->link('Next >', '#', array('escape' => 'utf-8')); + $expected = array( + 'a' => array('href' => '#'), + 'Next &gt;', + '/a' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->link('Next >', '#', array('escape' => false)); + $expected = array( + 'a' => array('href' => '#'), + 'Next >', + '/a' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->link($this->Html->image('test.gif'), '#', array(), false, false, false); + $expected = array( + 'a' => array('href' => '#'), + 'img' => array('src' => 'img/test.gif', 'alt' => ''), + '/a' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->image('test.gif', array('url' => '#')); + $expected = array( + 'a' => array('href' => '#'), + 'img' => array('src' => 'img/test.gif', 'alt' => ''), + '/a' + ); + $this->assertTags($result, $expected); + } +/** + * testImageTag method + * + * @access public + * @return void + */ + function testImageTag() { + $result = $this->Html->image('test.gif'); + $this->assertTags($result, array('img' => array('src' => 'img/test.gif', 'alt' => ''))); + + $result = $this->Html->image('http://google.com/logo.gif'); + $this->assertTags($result, array('img' => array('src' => 'http://google.com/logo.gif', 'alt' => ''))); + + $result = $this->Html->image(array('controller' => 'test', 'action' => 'view', 1, 'ext' => 'gif')); + $this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => ''))); + + $result = $this->Html->image('/test/view/1.gif'); + $this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => ''))); + + Configure::write('Asset.timestamp', true); + $result = $this->Html->image('logo.gif'); + $this->assertTags($result, array('img' => array('src' => 'preg:/img\/logo\.gif\?\d*/', 'alt' => ''))); + Configure::write('Asset.timestamp', false); + } +/** + * testStyle method + * + * @access public + * @return void + */ + function testStyle() { + $result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px')); + $expected = 'display:none; margin:10px;'; + $this->assertPattern('/^display\s*:\s*none\s*;\s*margin\s*:\s*10px\s*;?$/', $expected); + + $result = $this->Html->style(array('display'=> 'none', 'margin'=>'10px'), false); + $lines = explode("\n", $result); + $this->assertPattern('/^\s*display\s*:\s*none\s*;\s*$/', $lines[0]); + $this->assertPattern('/^\s*margin\s*:\s*10px\s*;?$/', $lines[1]); + } +/** + * testCssLink method + * + * @access public + * @return void + */ + function testCssLink() { + $result = $this->Html->css('screen'); + $expected = array( + 'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*css\/screen\.css/') + ); + $this->assertTags($result, $expected); + + $result = $this->Html->css('screen.css'); + $this->assertTags($result, $expected); + + $result = $this->Html->css('screen.css?1234'); + $expected['link']['href'] = 'preg:/.*css\/screen\.css\?1234/'; + $this->assertTags($result, $expected); + + $result = $this->Html->css('http://whatever.com/screen.css?1234'); + $expected['link']['href'] = 'preg:/http:\/\/.*\/screen\.css\?1234/'; + $this->assertTags($result, $expected); + + Configure::write('Asset.timestamp', true); + $result = $this->Html->css('cake.generic'); + $expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css\?[0-9]+/'; + $this->assertTags($result, $expected); + + $debug = Configure::read('debug'); + Configure::write('debug', 0); + + $result = $this->Html->css('cake.generic'); + $expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css/'; + $this->assertTags($result, $expected); + + Configure::write('Asset.timestamp', 'force'); + + $result = $this->Html->css('cake.generic'); + $expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css\?[0-9]+/'; + $this->assertTags($result, $expected); + + $webroot = $this->Html->webroot; + $this->Html->webroot = '/testing/'; + $result = $this->Html->css('cake.generic'); + $expected['link']['href'] = 'preg:/\/testing\/css\/cake\.generic\.css\?/'; + $this->assertTags($result, $expected); + $this->Html->webroot = $webroot; + + $webroot = $this->Html->webroot; + $this->Html->webroot = '/testing/longer/'; + $result = $this->Html->css('cake.generic'); + $expected['link']['href'] = 'preg:/\/testing\/longer\/css\/cake\.generic\.css\?/'; + $this->assertTags($result, $expected); + $this->Html->webroot = $webroot; + + Configure::write('Asset.timestamp', false); + Configure::write('debug', $debug); + + Configure::write('Asset.filter.css', 'css.php'); + $result = $this->Html->css('cake.generic'); + $expected['link']['href'] = 'preg:/.*ccss\/cake\.generic\.css/'; + $this->assertTags($result, $expected); + Configure::write('Asset.filter.css', false); + + $result = explode("\n", trim($this->Html->css(array('cake.generic', 'vendor.generic')))); + $expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css/'; + $this->assertTags($result[0], $expected); + $expected['link']['href'] = 'preg:/.*css\/vendor\.generic\.css/'; + $this->assertTags($result[1], $expected); + $this->assertEqual(count($result), 2); + } +/** + * testCharsetTag method + * + * @access public + * @return void + */ + function testCharsetTag() { + Configure::write('App.encoding', null); + $result = $this->Html->charset(); + $this->assertTags($result, array('meta' => array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8'))); + + Configure::write('App.encoding', 'ISO-8859-1'); + $result = $this->Html->charset(); + $this->assertTags($result, array('meta' => array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=iso-8859-1'))); + + $result = $this->Html->charset('UTF-7'); + $this->assertTags($result, array('meta' => array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-7'))); + } +/** + * testBreadcrumb method + * + * @access public + * @return void + */ + function testBreadcrumb() { + $this->Html->addCrumb('First', '#first'); + $this->Html->addCrumb('Second', '#second'); + $this->Html->addCrumb('Third', '#third'); + + $result = $this->Html->getCrumbs(); + $expected = array( + array('a' => array('href' => '#first')), + 'First', + '/a', + '&raquo;', + array('a' => array('href' => '#second')), + 'Second', + '/a', + '&raquo;', + array('a' => array('href' => '#third')), + 'Third', + '/a', + ); + $this->assertTags($result, $expected); + + $result = $this->Html->getCrumbs(' &gt; '); + $expected = array( + array('a' => array('href' => '#first')), + 'First', + '/a', + ' &gt; ', + array('a' => array('href' => '#second')), + 'Second', + '/a', + ' &gt; ', + array('a' => array('href' => '#third')), + 'Third', + '/a', + ); + $this->assertTags($result, $expected); + + $this->assertPattern('/^<a[^<>]+>First<\/a> &gt; <a[^<>]+>Second<\/a> &gt; <a[^<>]+>Third<\/a>$/', $result); + $this->assertPattern('/<a\s+href=["\']+\#first["\']+[^<>]*>First<\/a>/', $result); + $this->assertPattern('/<a\s+href=["\']+\#second["\']+[^<>]*>Second<\/a>/', $result); + $this->assertPattern('/<a\s+href=["\']+\#third["\']+[^<>]*>Third<\/a>/', $result); + $this->assertNoPattern('/<a[^<>]+[^href]=[^<>]*>/', $result); + + $this->Html->addCrumb('Fourth', null); + + $result = $this->Html->getCrumbs(); + $expected = array( + array('a' => array('href' => '#first')), + 'First', + '/a', + '&raquo;', + array('a' => array('href' => '#second')), + 'Second', + '/a', + '&raquo;', + array('a' => array('href' => '#third')), + 'Third', + '/a', + '&raquo;', + 'Fourth' + ); + $this->assertTags($result, $expected); + } +/** + * testNestedList method + * + * @access public + * @return void + */ + function testNestedList() { + $list = array( + 'Item 1', + 'Item 2' => array( + 'Item 2.1' + ), + 'Item 3', + 'Item 4' => array( + 'Item 4.1', + 'Item 4.2', + 'Item 4.3' => array( + 'Item 4.3.1', + 'Item 4.3.2' + ) + ), + 'Item 5' => array( + 'Item 5.1', + 'Item 5.2' + ) + ); + + $result = $this->Html->nestedList($list); + $expected = array( + '<ul', + '<li', 'Item 1', '/li', + '<li', 'Item 2', + '<ul', '<li', 'Item 2.1', '/li', '/ul', + '/li', + '<li', 'Item 3', '/li', + '<li', 'Item 4', + '<ul', + '<li', 'Item 4.1', '/li', + '<li', 'Item 4.2', '/li', + '<li', 'Item 4.3', + '<ul', + '<li', 'Item 4.3.1', '/li', + '<li', 'Item 4.3.2', '/li', + '/ul', + '/li', + '/ul', + '/li', + '<li', 'Item 5', + '<ul', + '<li', 'Item 5.1', '/li', + '<li', 'Item 5.2', '/li', + '/ul', + '/li', + '/ul' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, null); + $expected = array( + '<ul', + '<li', 'Item 1', '/li', + '<li', 'Item 2', + '<ul', '<li', 'Item 2.1', '/li', '/ul', + '/li', + '<li', 'Item 3', '/li', + '<li', 'Item 4', + '<ul', + '<li', 'Item 4.1', '/li', + '<li', 'Item 4.2', '/li', + '<li', 'Item 4.3', + '<ul', + '<li', 'Item 4.3.1', '/li', + '<li', 'Item 4.3.2', '/li', + '/ul', + '/li', + '/ul', + '/li', + '<li', 'Item 5', + '<ul', + '<li', 'Item 5.1', '/li', + '<li', 'Item 5.2', '/li', + '/ul', + '/li', + '/ul' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, array(), array(), 'ol'); + $expected = array( + '<ol', + '<li', 'Item 1', '/li', + '<li', 'Item 2', + '<ol', '<li', 'Item 2.1', '/li', '/ol', + '/li', + '<li', 'Item 3', '/li', + '<li', 'Item 4', + '<ol', + '<li', 'Item 4.1', '/li', + '<li', 'Item 4.2', '/li', + '<li', 'Item 4.3', + '<ol', + '<li', 'Item 4.3.1', '/li', + '<li', 'Item 4.3.2', '/li', + '/ol', + '/li', + '/ol', + '/li', + '<li', 'Item 5', + '<ol', + '<li', 'Item 5.1', '/li', + '<li', 'Item 5.2', '/li', + '/ol', + '/li', + '/ol' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, 'ol'); + $expected = array( + '<ol', + '<li', 'Item 1', '/li', + '<li', 'Item 2', + '<ol', '<li', 'Item 2.1', '/li', '/ol', + '/li', + '<li', 'Item 3', '/li', + '<li', 'Item 4', + '<ol', + '<li', 'Item 4.1', '/li', + '<li', 'Item 4.2', '/li', + '<li', 'Item 4.3', + '<ol', + '<li', 'Item 4.3.1', '/li', + '<li', 'Item 4.3.2', '/li', + '/ol', + '/li', + '/ol', + '/li', + '<li', 'Item 5', + '<ol', + '<li', 'Item 5.1', '/li', + '<li', 'Item 5.2', '/li', + '/ol', + '/li', + '/ol' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, array('class'=>'list')); + $expected = array( + array('ul' => array('class' => 'list')), + '<li', 'Item 1', '/li', + '<li', 'Item 2', + array('ul' => array('class' => 'list')), '<li', 'Item 2.1', '/li', '/ul', + '/li', + '<li', 'Item 3', '/li', + '<li', 'Item 4', + array('ul' => array('class' => 'list')), + '<li', 'Item 4.1', '/li', + '<li', 'Item 4.2', '/li', + '<li', 'Item 4.3', + array('ul' => array('class' => 'list')), + '<li', 'Item 4.3.1', '/li', + '<li', 'Item 4.3.2', '/li', + '/ul', + '/li', + '/ul', + '/li', + '<li', 'Item 5', + array('ul' => array('class' => 'list')), + '<li', 'Item 5.1', '/li', + '<li', 'Item 5.2', '/li', + '/ul', + '/li', + '/ul' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, array(), array('class' => 'item')); + $expected = array( + '<ul', + array('li' => array('class' => 'item')), 'Item 1', '/li', + array('li' => array('class' => 'item')), 'Item 2', + '<ul', array('li' => array('class' => 'item')), 'Item 2.1', '/li', '/ul', + '/li', + array('li' => array('class' => 'item')), 'Item 3', '/li', + array('li' => array('class' => 'item')), 'Item 4', + '<ul', + array('li' => array('class' => 'item')), 'Item 4.1', '/li', + array('li' => array('class' => 'item')), 'Item 4.2', '/li', + array('li' => array('class' => 'item')), 'Item 4.3', + '<ul', + array('li' => array('class' => 'item')), 'Item 4.3.1', '/li', + array('li' => array('class' => 'item')), 'Item 4.3.2', '/li', + '/ul', + '/li', + '/ul', + '/li', + array('li' => array('class' => 'item')), 'Item 5', + '<ul', + array('li' => array('class' => 'item')), 'Item 5.1', '/li', + array('li' => array('class' => 'item')), 'Item 5.2', '/li', + '/ul', + '/li', + '/ul' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, array(), array('even' => 'even', 'odd' => 'odd')); + $expected = array( + '<ul', + array('li' => array('class' => 'odd')), 'Item 1', '/li', + array('li' => array('class' => 'even')), 'Item 2', + '<ul', array('li' => array('class' => 'odd')), 'Item 2.1', '/li', '/ul', + '/li', + array('li' => array('class' => 'odd')), 'Item 3', '/li', + array('li' => array('class' => 'even')), 'Item 4', + '<ul', + array('li' => array('class' => 'odd')), 'Item 4.1', '/li', + array('li' => array('class' => 'even')), 'Item 4.2', '/li', + array('li' => array('class' => 'odd')), 'Item 4.3', + '<ul', + array('li' => array('class' => 'odd')), 'Item 4.3.1', '/li', + array('li' => array('class' => 'even')), 'Item 4.3.2', '/li', + '/ul', + '/li', + '/ul', + '/li', + array('li' => array('class' => 'odd')), 'Item 5', + '<ul', + array('li' => array('class' => 'odd')), 'Item 5.1', '/li', + array('li' => array('class' => 'even')), 'Item 5.2', '/li', + '/ul', + '/li', + '/ul' + ); + $this->assertTags($result, $expected); + + $result = $this->Html->nestedList($list, array('class'=>'list'), array('class' => 'item')); + $expected = array( + array('ul' => array('class' => 'list')), + array('li' => array('class' => 'item')), 'Item 1', '/li', + array('li' => array('class' => 'item')), 'Item 2', + array('ul' => array('class' => 'list')), array('li' => array('class' => 'item')), 'Item 2.1', '/li', '/ul', + '/li', + array('li' => array('class' => 'item')), 'Item 3', '/li', + array('li' => array('class' => 'item')), 'Item 4', + array('ul' => array('class' => 'list')), + array('li' => array('class' => 'item')), 'Item 4.1', '/li', + array('li' => array('class' => 'item')), 'Item 4.2', '/li', + array('li' => array('class' => 'item')), 'Item 4.3', + array('ul' => array('class' => 'list')), + array('li' => array('class' => 'item')), 'Item 4.3.1', '/li', + array('li' => array('class' => 'item')), 'Item 4.3.2', '/li', + '/ul', + '/li', + '/ul', + '/li', + array('li' => array('class' => 'item')), 'Item 5', + array('ul' => array('class' => 'list')), + array('li' => array('class' => 'item')), 'Item 5.1', '/li', + array('li' => array('class' => 'item')), 'Item 5.2', '/li', + '/ul', + '/li', + '/ul' + ); + $this->assertTags($result, $expected); + } +/** + * testMeta method + * + * @access public + * @return void + */ + function testMeta() { + $result = $this->Html->meta('this is an rss feed', array('controller' => 'posts', 'ext' => 'rss')); + $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.rss/', 'type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => 'this is an rss feed'))); + + $result = $this->Html->meta('rss', array('controller' => 'posts', 'ext' => 'rss'), array('title' => 'this is an rss feed')); + $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.rss/', 'type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => 'this is an rss feed'))); + + $result = $this->Html->meta('atom', array('controller' => 'posts', 'ext' => 'xml')); + $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.xml/', 'type' => 'application/atom+xml', 'title' => 'atom'))); + + $result = $this->Html->meta('non-existing'); + $this->assertTags($result, array('<meta')); + + $result = $this->Html->meta('non-existing', '/posts.xpp'); + $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.xpp/', 'type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => 'non-existing'))); + + $result = $this->Html->meta('non-existing', '/posts.xpp', array('type' => 'atom')); + $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.xpp/', 'type' => 'application/atom+xml', 'title' => 'non-existing'))); + + $result = $this->Html->meta('atom', array('controller' => 'posts', 'ext' => 'xml'), array('link' => '/articles.rss')); + $this->assertTags($result, array('link' => array('href' => 'preg:/.*\/articles\.rss/', 'type' => 'application/atom+xml', 'title' => 'atom'))); + + $result = $this->Html->meta(array('link' => 'favicon.ico', 'rel' => 'icon')); + $expected = array( + 'link' => array('href' => 'preg:/.*favicon\.ico/', 'rel' => 'icon'), + array('link' => array('href' => 'preg:/.*favicon\.ico/', 'rel' => 'shortcut icon')) + ); + $this->assertTags($result, $expected); + + $result = $this->Html->meta('icon', 'favicon.ico'); + $expected = array( + 'link' => array('href' => 'preg:/.*favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'icon'), + array('link' => array('href' => 'preg:/.*favicon\.ico/', 'type' => 'image/x-icon', 'rel' => 'shortcut icon')) + ); + $this->assertTags($result, $expected); + + $result = $this->Html->meta('keywords', 'these, are, some, meta, keywords'); + $this->assertTags($result, array('meta' => array('name' => 'keywords', 'content' => 'these, are, some, meta, keywords'))); + + $result = $this->Html->meta('description', 'this is the meta description'); + $this->assertTags($result, array('meta' => array('name' => 'description', 'content' => 'this is the meta description'))); + + $result = $this->Html->meta(array('name' => 'ROBOTS', 'content' => 'ALL')); + $this->assertTags($result, array('meta' => array('name' => 'ROBOTS', 'content' => 'ALL'))); + + $this->assertNull($this->Html->meta(array('name' => 'ROBOTS', 'content' => 'ALL'), null, array(), false)); + $view =& ClassRegistry::getObject('view'); + $result = $view->__scripts[0]; + $this->assertTags($result, array('meta' => array('name' => 'ROBOTS', 'content' => 'ALL'))); + } +/** + * testTableHeaders method + * + * @access public + * @return void + */ + function testTableHeaders() { + $result = $this->Html->tableHeaders(array('ID', 'Name', 'Date')); + $expected = array('<tr', '<th', 'ID', '/th', '<th', 'Name', '/th', '<th', 'Date', '/th', '/tr'); + $this->assertTags($result, $expected); + } +/** + * testTableCells method + * + * @access public + * @return void + */ + function testTableCells() { + $tr = array( + 'td content 1', + array('td content 2', array("width" => "100px")), + array('td content 3', "width=100px") + ); + $result = $this->Html->tableCells($tr); + $expected = array( + '<tr', + '<td', 'td content 1', '/td', + array('td' => array('width' => '100px')), 'td content 2', '/td', + array('td' => array('width' => 'preg:/100px/')), 'td content 3', '/td', + '/tr' + ); + $this->assertTags($result, $expected); + + $tr = array('td content 1', 'td content 2', 'td content 3'); + $result = $this->Html->tableCells($tr, null, null, true); + $expected = array( + '<tr', + array('td' => array('class' => 'column-1')), 'td content 1', '/td', + array('td' => array('class' => 'column-2')), 'td content 2', '/td', + array('td' => array('class' => 'column-3')), 'td content 3', '/td', + '/tr' + ); + $this->assertTags($result, $expected); + + $tr = array('td content 1', 'td content 2', 'td content 3'); + $result = $this->Html->tableCells($tr, true); + $expected = array( + '<tr', + array('td' => array('class' => 'column-1')), 'td content 1', '/td', + array('td' => array('class' => 'column-2')), 'td content 2', '/td', + array('td' => array('class' => 'column-3')), 'td content 3', '/td', + '/tr' + ); + $this->assertTags($result, $expected); + + $tr = array( + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3') + ); + $result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even')); + $expected = "<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>"; + $this->assertEqual($result, $expected); + + $tr = array( + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3') + ); + $result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even')); + $expected = "<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>"; + $this->assertEqual($result, $expected); + + $tr = array( + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3'), + array('td content 1', 'td content 2', 'td content 3') + ); + $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even')); + $result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'), false, false); + $expected = "<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>"; + $this->assertEqual($result, $expected); + } +/** + * testTag method + * + * @access public + * @return void + */ + function testTag() { + $result = $this->Html->tag('div'); + $this->assertTags($result, '<div'); + + $result = $this->Html->tag('div', 'text'); + $this->assertTags($result, '<div', 'text', '/div'); + + $result = $this->Html->tag('div', '<text>', array('class' => 'class-name'), true); + $this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div')); + + $result = $this->Html->tag('div', '<text>', 'class-name', true); + $this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div')); + } +/** + * testDiv method + * + * @access public + * @return void + */ + function testDiv() { + $result = $this->Html->div('class-name'); + $this->assertTags($result, array('div' => array('class' => 'class-name'))); + + $result = $this->Html->div('class-name', 'text'); + $this->assertTags($result, array('div' => array('class' => 'class-name'), 'text', '/div')); + + $result = $this->Html->div('class-name', '<text>', array(), true); + $this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div')); + } + +/** + * testPara method + * + * @access public + * @return void + */ + function testPara() { + $result = $this->Html->para('class-name', ''); + $this->assertTags($result, array('p' => array('class' => 'class-name'))); + + $result = $this->Html->para('class-name', 'text'); + $this->assertTags($result, array('p' => array('class' => 'class-name'), 'text', '/p')); + + $result = $this->Html->para('class-name', '<text>', array(), true); + $this->assertTags($result, array('p' => array('class' => 'class-name'), '&lt;text&gt;', '/p')); + } +/** + * tearDown method + * + * @access public + * @return void + */ + function tearDown() { + unset($this->Html); + } +} +?> \ No newline at end of file diff --git a/tests/cases/models/empty b/tests/cases/models/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/cases/models/gallery.test.php b/tests/cases/models/gallery.test.php new file mode 100644 index 0000000..05ba603 --- /dev/null +++ b/tests/cases/models/gallery.test.php @@ -0,0 +1,38 @@ +<?php +/* SVN FILE: $Id$ */ +/* Gallery Test cases generated on: 2009-01-04 18:01:18 : 1231123398*/ +App::import('Model', 'Gallery'); + +class GalleryTestCase extends CakeTestCase { + var $Gallery = null; + var $fixtures = array('app.gallery', 'app.photo', 'app.photo'); + + function startTest() { + $this->Gallery =& ClassRegistry::init('Gallery'); + } + + function testGalleryInstance() { + $this->assertTrue(is_a($this->Gallery, 'Gallery')); + } + + function testGalleryFind() { + $this->Gallery->recursive = -1; + $results = $this->Gallery->find('first'); + $this->assertTrue(!empty($results)); + + $expected = array('Gallery' => array( + 'id' => 1, + 'title' => 'Lorem ipsum dolor sit amet', + 'description' => 'Lorem ipsum dolor sit amet', + 'year_id' => 1, + 'parent_id' => 1, + 'created' => '2009-01-04 18:43:18', + 'date' => '2009-01-04', + 'photo_id' => 1, + 'lft' => 1, + 'rght' => 1 + )); + $this->assertEqual($results, $expected); + } +} +?> \ No newline at end of file diff --git a/tests/cases/models/photo.test.php b/tests/cases/models/photo.test.php new file mode 100644 index 0000000..aac61cb --- /dev/null +++ b/tests/cases/models/photo.test.php @@ -0,0 +1,37 @@ +<?php +/* SVN FILE: $Id$ */ +/* Photo Test cases generated on: 2009-01-04 18:01:00 : 1231122540*/ +App::import('Model', 'Photo'); + +class PhotoTestCase extends CakeTestCase { + var $Photo = null; + var $fixtures = array('app.photo', 'app.gallery', 'app.user'); + + function startTest() { + $this->Photo =& ClassRegistry::init('Photo'); + } + + function testPhotoInstance() { + $this->assertTrue(is_a($this->Photo, 'Photo')); + } + + function testPhotoFind() { + $this->Photo->recursive = -1; + $results = $this->Photo->find('first'); + $this->assertTrue(!empty($results)); + + $expected = array('Photo' => array( + 'id' => 1, + 'title' => 'Lorem ipsum dolor sit amet', + 'caption' => 'Lorem ipsum dolor sit amet', + 'gallery_id' => 1, + 'upload_date' => '2009-01-04 18:29:00', + 'approval_date' => '2009-01-04 18:29:00', + 'filename' => 'Lorem ipsum dolor sit amet', + 'filetype' => 1, + 'user_id' => 1 + )); + $this->assertEqual($results, $expected); + } +} +?> \ No newline at end of file diff --git a/tests/fixtures/empty b/tests/fixtures/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/fixtures/gallery_fixture.php b/tests/fixtures/gallery_fixture.php new file mode 100644 index 0000000..3c04560 --- /dev/null +++ b/tests/fixtures/gallery_fixture.php @@ -0,0 +1,34 @@ +<?php +/* SVN FILE: $Id$ */ +/* Gallery Fixture generated on: 2009-01-04 18:01:18 : 1231123398*/ + +class GalleryFixture extends CakeTestFixture { + var $name = 'Gallery'; + var $table = 'galleries'; + var $fields = array( + 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'title' => array('type'=>'string', 'null' => false, 'default' => NULL, 'length' => 30), + 'description' => array('type'=>'string', 'null' => true, 'default' => NULL), + 'year_id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'key' => 'index'), + 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL), + 'created' => array('type'=>'datetime', 'null' => false, 'default' => NULL), + 'date' => array('type'=>'date', 'null' => true, 'default' => NULL), + 'photo_id' => array('type'=>'integer', 'null' => true, 'default' => NULL), + 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL), + 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'year' => array('column' => 'year_id', 'unique' => 0)) + ); + var $records = array(array( + 'id' => 1, + 'title' => 'Lorem ipsum dolor sit amet', + 'description' => 'Lorem ipsum dolor sit amet', + 'year_id' => 1, + 'parent_id' => 1, + 'created' => '2009-01-04 18:43:18', + 'date' => '2009-01-04', + 'photo_id' => 1, + 'lft' => 1, + 'rght' => 1 + )); +} +?> \ No newline at end of file diff --git a/tests/fixtures/photo_fixture.php b/tests/fixtures/photo_fixture.php new file mode 100644 index 0000000..fe46d29 --- /dev/null +++ b/tests/fixtures/photo_fixture.php @@ -0,0 +1,32 @@ +<?php +/* SVN FILE: $Id$ */ +/* Photo Fixture generated on: 2009-01-04 18:01:00 : 1231122540*/ + +class PhotoFixture extends CakeTestFixture { + var $name = 'Photo'; + var $table = 'photos'; + var $fields = array( + 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'title' => array('type'=>'string', 'null' => true, 'default' => NULL, 'length' => 30), + 'caption' => array('type'=>'string', 'null' => true, 'default' => NULL), + 'gallery_id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'key' => 'index'), + 'upload_date' => array('type'=>'datetime', 'null' => false, 'default' => NULL), + 'approval_date' => array('type'=>'datetime', 'null' => true, 'default' => NULL), + 'filename' => array('type'=>'string', 'null' => false, 'default' => NULL), + 'filetype' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 6), + 'user_id' => array('type'=>'integer', 'null' => false, 'default' => NULL), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'gallery' => array('column' => 'gallery_id', 'unique' => 0)) + ); + var $records = array(array( + 'id' => 1, + 'title' => 'Lorem ipsum dolor sit amet', + 'caption' => 'Lorem ipsum dolor sit amet', + 'gallery_id' => 1, + 'upload_date' => '2009-01-04 18:29:00', + 'approval_date' => '2009-01-04 18:29:00', + 'filename' => 'Lorem ipsum dolor sit amet', + 'filetype' => 1, + 'user_id' => 1 + )); +} +?> \ No newline at end of file diff --git a/tests/groups/empty b/tests/groups/empty new file mode 100644 index 0000000..e69de29 diff --git a/vendors/shells/my_test.php b/vendors/shells/my_test.php new file mode 100644 index 0000000..3963c49 --- /dev/null +++ b/vendors/shells/my_test.php @@ -0,0 +1,10 @@ +<?php +class MyTestShell extends Shell { + var $uses = array('User'); + + function main() { + Configure::write('Company.name','Pizza, Inc.'); + Configure::store('blah', 'test.config', Configure::read('Company')); + } +} +?> \ No newline at end of file diff --git a/vendors/shells/tasks/empty b/vendors/shells/tasks/empty new file mode 100644 index 0000000..e69de29 diff --git a/vendors/shells/templates/empty b/vendors/shells/templates/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/elements/empty b/views/elements/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/errors/empty b/views/errors/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/galleries/add.ctp b/views/galleries/add.ctp new file mode 100644 index 0000000..acbc390 --- /dev/null +++ b/views/galleries/add.ctp @@ -0,0 +1,20 @@ +<div class="galleries form"> +<?php echo $form->create('Gallery');?> + <fieldset> + <legend><?php __('Add Gallery');?></legend> + <?php + echo $form->input('title'); + echo $form->input('description'); + echo $form->input('parent_id', array('options'=>$galleriesList,'empty' => ' ')); + echo $form->input('date', array('empty' => ' ')); + //echo $form->select('Parent', $galleriesList); + //echo $form->input('photo_id'); + ?> + </fieldset> +<?php echo $form->end('Submit');?> +</div> +<div class="actions"> + <ul> + <li><?php echo $html->link(__('List Galleries', true), array('action'=>'index'));?></li> + </ul> +</div> diff --git a/views/galleries/edit.ctp b/views/galleries/edit.ctp new file mode 100644 index 0000000..bf73324 --- /dev/null +++ b/views/galleries/edit.ctp @@ -0,0 +1,22 @@ +<div class="galleries form"> +<?php echo $form->create('Gallery');?> + <fieldset> + <legend><?php __('Edit Gallery');?></legend> + <?php + echo $form->input('id'); + echo $form->input('title'); + echo $form->input('description'); + echo $form->input('year_id'); + echo $form->input('parent_id', array('options'=>$galleriesList,'empty' => ' ')); + echo $form->input('date',array('empty' => ' ')); + //echo $form->input('photo_id'); + ?> + </fieldset> +<?php echo $form->end('Submit');?> +</div> +<div class="actions"> + <ul> + <li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value('Gallery.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Gallery.id'))); ?></li> + <li><?php echo $html->link(__('List Galleries', true), array('action'=>'index'));?></li> + </ul> +</div> diff --git a/views/galleries/index.ctp b/views/galleries/index.ctp new file mode 100644 index 0000000..33c36f8 --- /dev/null +++ b/views/galleries/index.ctp @@ -0,0 +1,68 @@ +<div class="galleries index"> +<h2><?php __('Galleries');?></h2> +<p> +<?php +echo $paginator->counter(array( +'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) +)); +?></p> +<table cellpadding="0" cellspacing="0"> +<tr> + <th><?php echo $paginator->sort('id');?></th> + <th><?php echo $paginator->sort('title');?></th> + <th><?php echo $paginator->sort('description');?></th> + <th><?php echo $paginator->sort('parent_id');?></th> + <th><?php echo $paginator->sort('created');?></th> + <th><?php echo $paginator->sort('date');?></th> + <th><?php echo $paginator->sort('photo_id');?></th> + <th class="actions"><?php __('Actions');?></th> +</tr> +<?php +$i = 0; +foreach ($galleries as $gallery): + $class = null; + if ($i++ % 2 == 0) { + $class = ' class="altrow"'; + } +?> + <tr<?php echo $class;?>> + <td> + <?php echo $gallery['Gallery']['id']; ?> + </td> + <td> + <?php echo $gallery['Gallery']['title']; ?> + </td> + <td> + <?php echo $gallery['Gallery']['description']; ?> + </td> + <td> + <?php echo $gallery['Gallery']['parent_id']; ?> + </td> + <td> + <?php echo $gallery['Gallery']['created']; ?> + </td> + <td> + <?php echo $gallery['Gallery']['date']; ?> + </td> + <td> + <?php echo $gallery['Gallery']['photo_id']; ?> + </td> + <td class="actions"> + <?php echo $html->link(__('View', true), array('action'=>'view', $gallery['Gallery']['id'])); ?> + <?php echo $html->link(__('Edit', true), array('action'=>'edit', $gallery['Gallery']['id'])); ?> + <?php echo $html->link(__('Delete', true), array('action'=>'delete', $gallery['Gallery']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $gallery['Gallery']['id'])); ?> + </td> + </tr> +<?php endforeach; ?> +</table> +</div> +<div class="paging"> + <?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> + | <?php echo $paginator->numbers();?> + <?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> +</div> +<div class="actions"> + <ul> + <li><?php echo $html->link(__('New Gallery', true), array('action'=>'add')); ?></li> + </ul> +</div> diff --git a/views/galleries/view.ctp b/views/galleries/view.ctp new file mode 100644 index 0000000..7b827c0 --- /dev/null +++ b/views/galleries/view.ctp @@ -0,0 +1,48 @@ +<div class="galleries view"> +<h2><?php __('Gallery');?></h2> + <dl><?php $i = 0; $class = ' class="altrow"';?> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['id']; ?> + &nbsp; + </dd> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['title']; ?> + &nbsp; + </dd> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Description'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['description']; ?> + &nbsp; + </dd> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Parent Id'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['parent_id']; ?> + &nbsp; + </dd> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Create Date'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['created']; ?> + &nbsp; + </dd> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['date']; ?> + &nbsp; + </dd> + <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Photo Id'); ?></dt> + <dd<?php if ($i++ % 2 == 0) echo $class;?>> + <?php echo $gallery['Gallery']['photo_id']; ?> + &nbsp; + </dd> + </dl> +</div> +<div class="actions"> + <ul> + <li><?php echo $html->link(__('Edit Gallery', true), array('action'=>'edit', $gallery['Gallery']['id'])); ?> </li> + <li><?php echo $html->link(__('Delete Gallery', true), array('action'=>'delete', $gallery['Gallery']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $gallery['Gallery']['id'])); ?> </li> + <li><?php echo $html->link(__('List Galleries', true), array('action'=>'index')); ?> </li> + <li><?php echo $html->link(__('New Gallery', true), array('action'=>'add')); ?> </li> + </ul> +</div> diff --git a/views/helpers/SmartyFormHelper.php b/views/helpers/SmartyFormHelper.php new file mode 100644 index 0000000..ad0ea47 --- /dev/null +++ b/views/helpers/SmartyFormHelper.php @@ -0,0 +1,160 @@ +<?php +/** + * SmartyForm Helper class for wrapping FormHelper methods + * + * requires SmartyView from http://cakeforge.org/snippet/detail.php?type=snippet&id=6 + * also requires php5 for reflection + * + * @link http://bakery.cakephp.org/articles/view/138 + * @author tclineks + * @version 0.0.1 + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @package cake + * @subpackage app.views.helpers + */ +class SmartyFormHelper extends Helper { + +/** + * Included helpers. + * + * @var array + */ + var $helpers = array('Form'); + +/** + * function to register wrappers with Smarty object + * - called from SmartyView + */ + function _register_smarty_functions(&$smarty) { + $smarty->register_function('form', array(&$this, 'form')); + } + +/** + * Smarty wrapper for FormHelper + * + * @param mixed $params params from Smarty template call + * @param Smarty $smarty Smarty object + * @return mixed + */ + function form($params, &$smarty) { + // sanity check for php version + if (!class_exists('ReflectionClass')) { + $smarty->trigger_error("SmartyForm: Error - requires php 5.0 or above", E_USER_NOTICE); + return; + } + + $function_name = $params['func']; + $assign = $params['assign']; + $show_call = $params['__show_call']; + unset($params['func']); + unset($params['assign']); + unset($params['__show_call']); + + $parameters = array(); // our final array of function parameters + + if (empty($function_name)) { + $smarty->trigger_error("SmartyForm: missing 'func' parameter", E_USER_NOTICE); + return; + } + + // process our params array to look for array representations + // based on key names separated by underscores + $processedParams = $this->_process_params($params); + + $arrayParams = array(); + + $classReflector = new ReflectionClass($this->Form); + + if ($classReflector->hasMethod($function_name)) { // quick sanity check + + $funcReflector = $classReflector->getMethod($function_name); + + $funcParams = $funcReflector->getParameters(); // returns an array of parameter names + + foreach ($funcParams as $param) { + $paramName = $param->getName(); + if (isset($processedParams[$paramName])) { + $parameters[$paramName] = $processedParams[$paramName]; + unset($processedParams[$paramName]); + } else { + if ($param->isDefaultValueAvailable()) { + $parameters[$paramName] = $param->getDefaultValue(); + // mark the index of array parameters for potential later population + if (is_array($parameters[$paramName])) { + $arrayParams[] = $paramName; + } + } else if (!$param->isOptional()) { + $smarty->trigger_error("SmartyForm: Error ".$paramName." parameter is required for method ".$function_name, E_USER_NOTICE); + } else { + $parameters[$paramName] = null; + } + } + } + + // check for unfilled array parameters and populate the first with remaining $params + if (count($arrayParams)) { + $parameters[$arrayParams[0]] = $processedParams; + } + + } else { + $smarty->trigger_error("SmartyForm: Error " . $classReflector->name . "::" . $function_name . " is not defined", E_USER_NOTICE); + return; + } + + if ($show_call) { + echo '<pre>SmartyForm calling $form->' . $function_name . ' with these parameters: <br />'; + var_dump($parameters); + echo '</pre>'; + } + + $result = call_user_func_array(array($this->Form,$function_name),$parameters); + + if (!empty($assign)) { + $smarty->assign($assign, $result); + } else { + return $result; + } + } + + /** + * scans an associative array looking for array keys + * that represent nested arrays through the use of the delimiter + * parameter (by default an underscore) + * + * @param array associative array of values + * @param string delimiter + * @return array + */ + function _process_params($params = array(), $delimiter = '_') { + $result = array(); + foreach ($params as $key => $value) { + $a = explode($delimiter,$key); + if (count($a) > 1) { + $this->_recursively_assign($result,$a,$value); + } else { + $result[$key] = $value; + } + } + return $result; + } + + /** + * recursive method to build nested associative arrays + * from delimited key names. fancy! + * + * @param array result array, passed by reference + * @param array array of key name components, split by the delimiter in _process_params + * @param string the value to ultimately assign to the nested array + */ + function _recursively_assign(&$result,$keyArray,$value) { + $k = array_shift($keyArray); + if (count($keyArray) > 1) { + $this->_recursively_assign($result[$k],$keyArray,$value); + } else { + $kk = $keyArray[0]; + $result[$k][$kk] = $value; + } + } + +} +?> \ No newline at end of file diff --git a/views/helpers/empty b/views/helpers/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/helpers/smarty_html.php b/views/helpers/smarty_html.php new file mode 100644 index 0000000..9c29f45 --- /dev/null +++ b/views/helpers/smarty_html.php @@ -0,0 +1,161 @@ +<?php +/** + * SmartyHtml Helper class for wrapping HtmlHelper methods + * + * requires SmartyView from http://cakeforge.org/snippet/detail.php?type=snippet&id=6 (>= 1.0.0.3) + * also requires php5 for reflection + * - for php4 - find older version (0.0.0.1alpha) for (a more tedius) example to work with + * + * @link http://bakery.cakephp.org/articles/view/138 + * @author tclineks, sbarre + * @version 0.0.2 + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @package cake + * @subpackage app.views.helpers + */ +class SmartyHtmlHelper extends Helper { + +/** + * Included helpers. + * + * @var array + */ + var $helpers = array('Html'); + +/** + * function to register wrappers with Smarty object + * - called from SmartyView + */ + function _register_smarty_functions(&$smarty) { + $smarty->register_function('html', array(&$this, 'html')); + } + +/** + * Smarty wrapper for HtmlHelper + * + * @param mixed $params params from Smarty template call + * @param Smarty $smarty Smarty object + * @return mixed + */ + function html($params, &$smarty) { + // sanity check for php version + if (!class_exists('ReflectionClass')) { + $smarty->trigger_error("SmartyHtml: Error - requires php 5.0 or above", E_USER_NOTICE); + return; + } + + $function_name = $params['func']; + $assign = $params['assign']; + $show_call = $params['__show_call']; + unset($params['func']); + unset($params['assign']); + unset($params['__show_call']); + + $parameters = array(); // our final array of function parameters + + if (empty($function_name)) { + $smarty->trigger_error("SmartyHtml: missing 'func' parameter", E_USER_NOTICE); + return; + } + + // process our params array to look for array representations + // based on key names separated by underscores + $processedParams = $this->_process_params($params); + + $arrayParams = array(); + + $classReflector = new ReflectionClass($this->Html); + + if ($classReflector->hasMethod($function_name)) { // quick sanity check + + $funcReflector = $classReflector->getMethod($function_name); + + $funcParams = $funcReflector->getParameters(); // returns an array of parameter names + + foreach ($funcParams as $param) { + $paramName = $param->getName(); + if (isset($processedParams[$paramName])) { + $parameters[$paramName] = $processedParams[$paramName]; + unset($processedParams[$paramName]); + } else { + if ($param->isDefaultValueAvailable()) { + $parameters[$paramName] = $param->getDefaultValue(); + // mark the index of array parameters for potential later population + if (is_array($parameters[$paramName])) { + $arrayParams[] = $paramName; + } + } else if (!$param->isOptional()) { + $smarty->trigger_error("SmartyHtml: Error ".$paramName." parameter is required for method ".$function_name, E_USER_NOTICE); + } else { + $parameters[$paramName] = null; + } + } + } + + // check for unfilled array parameters and populate the first with remaining $params + if (count($arrayParams)) { + $parameters[$arrayParams[0]] = $processedParams; + } + + } else { + $smarty->trigger_error("SmartyHtml: Error " . $classReflector->name . "::" . $function_name . " is not defined", E_USER_NOTICE); + return; + } + + if ($show_call) { + echo '<pre>SmartyHtml calling $html->' . $function_name . ' with these parameters: <br />'; + var_dump($parameters); + echo '</pre>'; + } + + $result = call_user_func_array(array($this->Html,$function_name),$parameters); + + if (!empty($assign)) { + $smarty->assign($assign, $result); + } else { + return $result; + } + } + + /** + * scans an associative array looking for array keys + * that represent nested arrays through the use of the delimiter + * parameter (by default an underscore) + * + * @param array associative array of values + * @param string delimiter + * @return array + */ + function _process_params($params = array(), $delimiter = '_') { + $result = array(); + foreach ($params as $key => $value) { + $a = explode($delimiter,$key); + if (count($a) > 1) { + $this->_recursively_assign($result,$a,$value); + } else { + $result[$key] = $value; + } + } + return $result; + } + + /** + * recursive method to build nested associative arrays + * from delimited key names. fancy! + * + * @param array result array, passed by reference + * @param array array of key name components, split by the delimiter in _process_params + * @param string the value to ultimately assign to the nested array + */ + function _recursively_assign(&$result,$keyArray,$value) { + $k = array_shift($keyArray); + if (count($keyArray) > 1) { + $this->_recursively_assign($result[$k],$keyArray,$value); + } else { + $kk = $keyArray[0]; + $result[$k][$kk] = $value; + } + } + +} +?> \ No newline at end of file diff --git a/views/layouts/default.ctp b/views/layouts/default.ctp new file mode 100644 index 0000000..ce83c6a --- /dev/null +++ b/views/layouts/default.ctp @@ -0,0 +1,63 @@ +<?php +/* SVN FILE: $Id: default.ctp 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.cake.libs.view.templates.layouts + * @since CakePHP(tm) v 0.10.0.1076 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @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> + <?php echo $html->charset(); ?> + <title> + Edufoto - <?php echo $title_for_layout; ?> + </title> + <?php + echo $html->meta('icon'); + + echo $html->css('cake.generic'); + + echo $scripts_for_layout; + ?> +</head> +<body> + <div id="container"> + <div id="header"> + <h1><?php echo $html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org'); ?></h1> + </div> + <div id="content"> + + <?php $session->flash(); ?> + + <?php echo $content_for_layout; ?> + + </div> + <div id="footer"> + <?php echo $html->link( + $html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")), + 'http://www.cakephp.org/', + array('target'=>'_blank'), null, false + ); + ?> + </div> + </div> + <?php echo $cakeDebug; ?> +</body> +</html> \ No newline at end of file diff --git a/views/layouts/email/html/default.ctp b/views/layouts/email/html/default.ctp new file mode 100644 index 0000000..e69de29 diff --git a/views/layouts/email/text/default.ctp b/views/layouts/email/text/default.ctp new file mode 100644 index 0000000..e69de29 diff --git a/views/layouts/js/empty b/views/layouts/js/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/layouts/rss/empty b/views/layouts/rss/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/layouts/xml/empty b/views/layouts/xml/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/posts/add.ctp b/views/posts/add.ctp new file mode 100644 index 0000000..0963bbb --- /dev/null +++ b/views/posts/add.ctp @@ -0,0 +1,9 @@ +/app/views/posts/add.ctp + +<h1>Add Post</h1> +<?php +echo $form->create('Post'); +echo $form->input('title'); +echo $form->input('body', array('rows' => '3')); +echo $form->end('Save Post'); +?> \ No newline at end of file diff --git a/views/posts/edit.ctp b/views/posts/edit.ctp new file mode 100644 index 0000000..78bd7c3 --- /dev/null +++ b/views/posts/edit.ctp @@ -0,0 +1,10 @@ +/app/views/posts/edit.ctp + +<h1>Edit Post</h1> +<?php + echo $form->create('Post', array('action' => 'edit')); + echo $form->input('title'); + echo $form->input('body', array('rows' => '3')); + echo $form->input('id', array('type'=>'hidden')); + echo $form->end('Save Post'); +?> diff --git a/views/posts/index.ctp b/views/posts/index.ctp new file mode 100644 index 0000000..699cd5c --- /dev/null +++ b/views/posts/index.ctp @@ -0,0 +1,34 @@ +/app/views/posts/index.ctp (edit links added) + +<h1>Blog posts</h1> +<p><?php echo $html->link("Add Post", "/posts/add"); ?> +<table> + <tr> + <th>Id</th> + <th>Title</th> + <th>Action</th> + <th>Created</th> + </tr> + +<!-- Here's where we loop through our $posts array, printing out post info --> + +<?php foreach ($posts as $post): ?> + <tr> + <td><?php echo $post['Post']['id']; ?></td> + <td> + <?php echo $html->link($post['Post']['title'],'/posts/view/'.$post['Post']['id']);?> + </td> + <td> + <?php echo $html->link( + 'Delete', + "/posts/delete/{$post['Post']['id']}", + null, + 'Are you sure?' + )?> + <?php echo $html->link('Edit', '/posts/edit/'.$post['Post']['id']);?> + </td> + <td><?php echo $post['Post']['created']; ?></td> + </tr> +<?php endforeach; ?> + +</table> diff --git a/views/posts/view.ctp b/views/posts/view.ctp new file mode 100644 index 0000000..bdea5ea --- /dev/null +++ b/views/posts/view.ctp @@ -0,0 +1,7 @@ +<!-- File: /app/views/posts/view.ctp --> + +<h1><?php echo $post['Post']['title']?></h1> + +<p><small>Created: <?php echo $post['Post']['created']?></small></p> + +<p><?php echo $post['Post']['body']?></p> \ No newline at end of file diff --git a/views/scaffolds/empty b/views/scaffolds/empty new file mode 100644 index 0000000..e69de29 diff --git a/views/users/login.ctp b/views/users/login.ctp new file mode 100644 index 0000000..2b1507f --- /dev/null +++ b/views/users/login.ctp @@ -0,0 +1,17 @@ +<?php +/*if ($session->check('Message.auth')) { + ?> + <p class="error"> + <strong><?php __('Error'); ?>: </strong> + <?php ?> + </p> + <?php +}*/ + +if ($session->check('Message.auth')) { $session->flash('auth'); } + +echo $form->create('User', array('action' => 'login')); +echo $form->input('email_address',array('between'=>'<br>','class'=>'text')); +echo $form->input('password',array('between'=>'<br>','class'=>'text')); +echo $form->end('Sign In'); +?> \ No newline at end of file diff --git a/webroot/.htaccess b/webroot/.htaccess new file mode 100644 index 0000000..f9d8b93 --- /dev/null +++ b/webroot/.htaccess @@ -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> \ No newline at end of file diff --git a/webroot/css.php b/webroot/css.php new file mode 100644 index 0000000..7daf080 --- /dev/null +++ b/webroot/css.php @@ -0,0 +1,102 @@ +<?php +/* SVN FILE: $Id: css.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * Short description for file. + * + * Long description for file + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +if (!defined('CAKE_CORE_INCLUDE_PATH')) { + header('HTTP/1.1 404 Not Found'); + exit('File Not Found'); +} +/** + * Enter description here... + */ +if (!class_exists('File')) { + uses('file'); +} +/** + * Enter description here... + * + * @param unknown_type $path + * @param unknown_type $name + * @return unknown + */ + function make_clean_css($path, $name) { + App::import('Vendor', 'csspp' . DS . 'csspp'); + $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); + $templateModified = time(); + } + + 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: max-age=86400, must-revalidate"); // HTTP/1.1 + header("Pragma: cache"); // HTTP/1.0 + print $output; +?> \ No newline at end of file diff --git a/webroot/css/cake.generic.css b/webroot/css/cake.generic.css new file mode 100644 index 0000000..7d2b582 --- /dev/null +++ b/webroot/css/cake.generic.css @@ -0,0 +1,479 @@ +/* SVN FILE: $Id: cake.generic.css 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot.css + * @since CakePHP(tm) + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ + +* { + margin:0; + padding:0; +} + +/* General Style Info */ +body { + background: #003d4c; + color: #fff; + font-family:'lucida grande',verdana,helvetica,arial,sans-serif; + font-size:90%; + margin: 0; +} +a { + background:#fff; + color: #003d4c; + text-decoration: underline; + font-weight: bold; +} +a:hover { + background:#fff; + color: #003d4c; + text-decoration:none; +} +a img { + border:none; +} +h1, h2, h3, h4 { + font-weight: normal; +} +h1 { + background:#fff; + color: #003d4c; + font-size: 100%; + margin: 0.1em 0; +} +h2 { + background:#fff; + color: #e32; + font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif; + font-size: 190%; + margin: 0.3em 0; + padding-top: 0.8em; +} +h3 { + color: #993; + font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif; + font-size: 165%; + padding-top: 1.5em; +} +h4 { + color: #993; + font-weight: normal; + padding-top: 0.5em; +} +ul, li { + margin: 0 12px; +} + +/* Layout */ +#container { + text-align: left; +} + +#header{ + padding: 10px 20px; +} +#header h1 { + background: #003d4c url('../img/cake.icon.gif') no-repeat left; + color: #fff; + padding: 0px 30px; +} +#header h1 a { + color: #fff; + background: #003d4c; + font-weight: normal; + text-decoration: none; +} +#header h1 a:hover { + color: #fff; + background: #003d4c; + text-decoration: underline; +} +#content{ + background: #fff; + clear: both; + color: #333; + padding: 10px 20px 40px 20px; + overflow: auto; +} +#footer { + clear: both; + padding: 6px 10px; + text-align: right; +} + +/* Tables */ +table { + background: #fff; + border:1px solid #ccc; + border-right:0; + clear: both; + color: #333; + margin-bottom: 10px; + width: 100%; +} +th { + background: #f2f2f2; + border:1px solid #bbb; + border-top: 1px solid #fff; + border-left: 1px solid #fff; + text-align: center; +} +th a { + background:#f2f2f2; + display: block; + padding: 2px 4px; + text-decoration: none; +} +th a:hover { + background: #ccc; + color: #333; + text-decoration: none; +} +table tr td { + background: #fff; + border-right: 1px solid #ccc; + padding: 4px; + text-align: center; + vertical-align: top; +} +table tr.altrow td { + background: #f4f4f4; +} +td.actions { + text-align: center; + white-space: nowrap; +} +td.actions a { + margin: 0px 6px; +} +.cake-sql-log table { + background: #f4f4f4; +} +.cake-sql-log td { + padding: 4px 8px; + text-align: left; +} + +/* Paging */ +div.paging { + background:#fff; + color: #ccc; + margin-bottom: 2em; +} +div.paging div.disabled { + color: #ddd; + display: inline; +} +div.paging span { +} +div.paging span.current { + color: #000; +} +div.paging span a { +} + +/* Scaffold View */ +dl { + line-height: 2em; + margin: 0em 0em; + width: 60%; +} +dl.altrow { + background: #f4f4f4; +} +dt { + font-weight: bold; + padding-left: 4px; + vertical-align: top; +} +dd { + margin-left: 10em; + margin-top: -2em; + vertical-align: top; +} + +/* Forms */ +form { + clear: both; + margin-right: 20px; + padding: 0; + width: 80%; +} +fieldset { + border: 1px solid #ccc; + margin-top: 30px; + padding: 16px 20px; +} +fieldset legend { + background:#fff; + color: #e32; + font-size: 160%; + font-weight: bold; +} +fieldset fieldset { + margin-top: 0px; + margin-bottom: 20px; + padding: 16px 10px; +} +fieldset fieldset legend { + font-size: 120%; + font-weight: normal; +} +fieldset fieldset div { + clear: left; + margin: 0 20px; +} +form div { + clear: both; + margin-bottom: 1em; + padding: .5em; + vertical-align: text-top; +} +form div.input { + color: #444; +} +form div.required { + color: #333; + font-weight: bold; +} +form div.submit { + border: 0; + clear: both; + margin-top: 10px; + margin-left: 140px; +} +label { + display: block; + font-size: 110%; + padding-right: 20px; +} +input, textarea { + clear: both; + font-size: 140%; + font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif; + padding: 2px; + width: 100%; +} +select { + clear: both; + font-size: 120%; + vertical-align: text-bottom; +} +select[multiple=multiple] { + width: 100%; +} +option { + font-size: 120%; + padding: 0 3px; +} +input[type=checkbox] { + clear: left; + float: left; + margin: 0px 6px 7px 2px; + width: auto; +} +input[type=radio] { + float:left; + width:auto; + margin: 0 3px 7px 0; +} +div.radio label { + margin: 0 0 6px 20px; +} +input[type=submit] { + display: inline; + font-size: 110%; + padding: 2px 5px; + width: auto; + vertical-align: bottom; +} + +/* Notices and Errors */ +div.message { + clear: both; + color: #900; + font-size: 140%; + font-weight: bold; + margin: 1em 0; +} +div.error-message { + clear: both; + color: #900; + font-weight: bold; +} +p.error { + background-color: #e32; + color: #fff; + font-family: Courier, monospace; + font-size: 120%; + line-height: 140%; + padding: 0.8em; + margin: 1em 0; +} +p.error em { + color: #000; + font-weight: normal; + line-height: 140%; +} +.notice { + background: #ffcc00; + color: #000; + display: block; + font-family: Courier, monospace; + font-size: 120%; + line-height: 140%; + padding: 0.8em; + margin: 1em 0; +} +.success { + background: green; + color: #fff; +} + +/* Actions */ +div.actions ul { + margin: 0px 0; + padding: 0; +} +div.actions li { + display: inline; + list-style-type: none; + line-height: 2em; + margin: 0 2em 0 0; + white-space: nowrap; +} +div.actions ul li a { + background:#fff; + color: #003d4c; + text-decoration: none; +} +div.actions ul li a:hover { + color: #333; + text-decoration: underline; +} + +/* Related */ +div.related { + clear: both; + display: block; +} + +/* Debugging */ +pre { + color: #000; + background: #f0f0f0; + padding: 1em; +} +pre.cake-debug { + background: #ffcc00; + font-size: 120%; + line-height: 140%; + margin-top: 1em; + overflow: auto; + position: relative; +} +div.cake-stack-trace { + background: #fff; + border: 4px dotted #ffcc00; + color: #333; + margin: 0px; + padding: 6px; + font-size: 120%; + line-height: 140%; + overflow: auto; + position: relative; +} +div.cake-code-dump pre { + position: relative; + overflow: auto; +} +div.cake-stack-trace pre, div.cake-code-dump pre { + color: #000; + background-color: #F0F0F0; + margin: 0px; + padding: 1em; + overflow: auto; +} +div.cake-code-dump pre, div.cake-code-dump pre code { + clear: both; + font-size: 12px; + line-height: 15px; + margin: 4px 2px; + padding: 4px; + overflow: auto; +} +div.cake-code-dump span.code-highlight { + background-color: #ff0; + padding: 4px; +} +div.code-coverage-results div.code-line { + padding-left:5px; + display:block; + margin-left:10px; +} +div.code-coverage-results div.uncovered span.content { + background:#ecc; +} +div.code-coverage-results div.covered span.content { + background:#cec; +} +div.code-coverage-results div.ignored span.content { + color:#aaa; +} +div.code-coverage-results span.line-num { + color:#666; + display:block; + float:left; + width:20px; + text-align:right; + margin-right:5px; +} +div.code-coverage-results span.line-num strong { + color:#666; +} +div.code-coverage-results div.start { + border:1px solid #aaa; + border-width:1px 1px 0px 1px; + margin-top:30px; + padding-top:5px; +} +div.code-coverage-results div.end { + border:1px solid #aaa; + border-width:0px 1px 1px 1px; + margin-bottom:30px; + padding-bottom:5px; +} +div.code-coverage-results div.realstart { + margin-top:0px; +} +div.code-coverage-results p.note { + color:#bbb; + padding:5px; + margin:5px 0 10px; + font-size:10px; +} +div.code-coverage-results span.result-bad { + color: #a00; +} +div.code-coverage-results span.result-ok { + color: #fa0; +} +div.code-coverage-results span.result-good { + color: #0a0; +} \ No newline at end of file diff --git a/webroot/favicon.ico b/webroot/favicon.ico new file mode 100644 index 0000000..b36e81f Binary files /dev/null and b/webroot/favicon.ico differ diff --git a/webroot/img/cake.icon.gif b/webroot/img/cake.icon.gif new file mode 100644 index 0000000..f29f72e Binary files /dev/null and b/webroot/img/cake.icon.gif differ diff --git a/webroot/img/cake.power.gif b/webroot/img/cake.power.gif new file mode 100644 index 0000000..8f8d570 Binary files /dev/null and b/webroot/img/cake.power.gif differ diff --git a/webroot/index.php b/webroot/index.php new file mode 100644 index 0000000..5ffb0f5 --- /dev/null +++ b/webroot/index.php @@ -0,0 +1,93 @@ +<?php +/* SVN FILE: $Id: index.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * Short description for file. + * + * Long description for file + * + * PHP versions 4 and 5 + * + * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/** + * Use the DS to separate the directories in other defines + */ + 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. + * When using custom settings be sure to use the DS and do not add a trailing DS. + */ + +/** + * The full path to the directory which holds "app", WITHOUT a trailing DS. + * + */ + if (!defined('ROOT')) { + define('ROOT', dirname(dirname(dirname(__FILE__)))); + } +/** + * The actual directory name for the "app". + * + */ + if (!defined('APP_DIR')) { + define('APP_DIR', basename(dirname(dirname(__FILE__)))); + } +/** + * The absolute path to the "cake" directory, WITHOUT a trailing DS. + * + */ + if (!defined('CAKE_CORE_INCLUDE_PATH')) { + define('CAKE_CORE_INCLUDE_PATH', ROOT); + } + +/** + * Editing below this line should NOT be necessary. + * Change at your own risk. + * + */ + 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', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'))) { + 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); + } + } + if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) { + trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); + } + if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { + return; + } else { + $Dispatcher = new Dispatcher(); + $Dispatcher->dispatch($url); + } + if (Configure::read() > 0) { + echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->"; + } +?> \ No newline at end of file diff --git a/webroot/info.php b/webroot/info.php new file mode 100644 index 0000000..968c8df --- /dev/null +++ b/webroot/info.php @@ -0,0 +1,3 @@ +<?php +phpinfo(); +?> \ No newline at end of file diff --git a/webroot/js/vendors.php b/webroot/js/vendors.php new file mode 100644 index 0000000..bd14cc2 --- /dev/null +++ b/webroot/js/vendors.php @@ -0,0 +1,42 @@ +<?php +/* SVN FILE: $Id: vendors.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * 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(tm) : Rapid Development Framework (http://www.cakephp.org) + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot.js + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/** + * Enter description here... + */ +if (isset($_GET['file'])) { + $file = $_GET['file']; + $pos = strpos($file, '..'); + if ($pos === false) { + if (is_file('../../vendors/javascript/'.$file) && (preg_match('/(\/.+)\\.js/', $file))) { + readfile('../../vendors/javascript/'.$file); + return; + } + } +} +header('HTTP/1.1 404 Not Found'); +?> \ No newline at end of file diff --git a/webroot/test.php b/webroot/test.php new file mode 100644 index 0000000..c321095 --- /dev/null +++ b/webroot/test.php @@ -0,0 +1,182 @@ +<?php +/* SVN FILE: $Id: test.php 7945 2008-12-19 02:16:01Z gwoo $ */ +/** + * Short description for file. + * + * Long description for file + * + * PHP versions 4 and 5 + * + * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite> + * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * + * Licensed under The Open Group Test Suite License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) + * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests + * @package cake + * @subpackage cake.cake.tests.libs + * @since CakePHP(tm) v 1.2.0.4433 + * @version $Revision: 7945 $ + * @modifiedby $LastChangedBy: gwoo $ + * @lastmodified $Date: 2008-12-18 20:16:01 -0600 (Thu, 18 Dec 2008) $ + * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License + */ +error_reporting(E_ALL); +set_time_limit(0); +ini_set('memory_limit','128M'); +ini_set('display_errors', 1); +/** + * Use the DS to separate the directories in other defines + */ + 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. + * When using custom settings be sure to use the DS and do not add a trailing DS. + */ + +/** + * The full path to the directory which holds "app", WITHOUT a trailing DS. + * + */ + if (!defined('ROOT')) { + define('ROOT', dirname(dirname(dirname(__FILE__)))); + } +/** + * The actual directory name for the "app". + * + */ + if (!defined('APP_DIR')) { + define('APP_DIR', basename(dirname(dirname(__FILE__)))); + } +/** + * The absolute path to the "cake" directory, WITHOUT a trailing DS. + * + */ + if (!defined('CAKE_CORE_INCLUDE_PATH')) { + define('CAKE_CORE_INCLUDE_PATH', ROOT); + } +/** + * Editing below this line should not be necessary. + * Change at your own risk. + * + */ +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', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'))) { + 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); + } +} + +if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) { + trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); +} + +$corePath = Configure::corePaths('cake'); +if (isset($corePath[0])) { + define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS); +} else { + define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH); +} +echo 'TEST_CAKE_CORE_INCLUDE_PATH='.TEST_CAKE_CORE_INCLUDE_PATH; + +require_once CAKE_TESTS_LIB . 'test_manager.php'; + +if (Configure::read('debug') < 1) { + die(__('Debug setting does not allow access to this url.', true)); +} + +if (!isset($_SERVER['SERVER_NAME'])) { + $_SERVER['SERVER_NAME'] = ''; +} +if (empty( $_GET['output'])) { + $_GET['output'] = 'html'; +} +/** + * + * Used to determine output to display + */ +define('CAKE_TEST_OUTPUT_HTML', 1); +define('CAKE_TEST_OUTPUT_TEXT', 2); + +if (isset($_GET['output']) && $_GET['output'] == 'html') { + define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML); +} else { + Debugger::output('txt'); + define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT); +} + +if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) { + CakePHPTestHeader(); + include CAKE_TESTS_LIB . 'simpletest.php'; + CakePHPTestSuiteFooter(); + exit(); +} + +$analyzeCodeCoverage = false; +if (isset($_GET['code_coverage'])) { + $analyzeCodeCoverage = true; + require_once CAKE_TESTS_LIB . 'code_coverage_manager.php'; + if (!extension_loaded('xdebug')) { + CakePHPTestHeader(); + include CAKE_TESTS_LIB . 'xdebug.php'; + CakePHPTestSuiteFooter(); + exit(); + } +} + +CakePHPTestHeader(); +CakePHPTestSuiteHeader(); +define('RUN_TEST_LINK', $_SERVER['PHP_SELF']); + +if (isset($_GET['group'])) { + if ('all' == $_GET['group']) { + TestManager::runAllTests(CakeTestsGetReporter()); + } else { + if ($analyzeCodeCoverage) { + CodeCoverageManager::start($_GET['group'], CakeTestsGetReporter()); + } + TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter()); + if ($analyzeCodeCoverage) { + CodeCoverageManager::report(); + } + } + + CakePHPTestRunMore(); + CakePHPTestAnalyzeCodeCoverage(); +} elseif (isset($_GET['case'])) { + if ($analyzeCodeCoverage) { + CodeCoverageManager::start($_GET['case'], CakeTestsGetReporter()); + } + + TestManager::runTestCase($_GET['case'], CakeTestsGetReporter()); + + if ($analyzeCodeCoverage) { + CodeCoverageManager::report(); + } + + CakePHPTestRunMore(); + CakePHPTestAnalyzeCodeCoverage(); +} elseif (isset($_GET['show']) && $_GET['show'] == 'cases') { + CakePHPTestCaseList(); +} else { + CakePHPTestGroupTestList(); +} +CakePHPTestSuiteFooter(); +$output = ob_get_clean(); +echo $output; +?> \ No newline at end of file