diff --git a/.gitignore b/.gitignore index 9edf61016..f807a01ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ -/app/config -/app/tmp -/plugins -/vendors \ No newline at end of file +app/tests/ +app/tmp +app/lib/cronjobs +/joomla +/croogo +*.7z +*.LCK +.gitignore \ No newline at end of file diff --git a/README.txt b/README.txt new file mode 100644 index 000000000..e69de29bb diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 000000000..4023d962c --- /dev/null +++ b/TODO.txt @@ -0,0 +1,164 @@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +BLOG +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + posts + delete + delete related comments + delete related tags if they are not being used + test new parent::delete/toggle + + users can manage posts by tag ( assign tags to a user and they can only + work on posts / comments with those tags) + + new posts to add to twitter + + Comments + option to enable / disable + option for moderation + purge :: delete all comments that are not active older than one month. + comment count box not right + actions.ctp heading need __() + test new parent::delete/toggle + profile picture ( gravitar ) +================================================================================ + + + + + + + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +CORE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + cache + parent action to delete cache + admin method to clear all + + installer + populate database + table structure + core settings + optional demo data + layout + cache menus + based on group + will need to cache an array and not the whole layout so the selected + can still be set + + acl + row based acl? + cascading groups ( inherit from parent/child ) + + templates + integrate ceeram's template thing once 1.3 is sorted + + delete validation + confirmation with jquery model box that is a form, remove delete by id + and add viwes for delete confirm when there is no js + + groups + developer + superadmin + admin + moderator + publisher + + superuser + moderator + publisher + public + guest + + viewable + fix : updates in admin + fix : updates in index + + backups + check for large backups and break them up somehow. maybe with a while + loop while( $last_id < $current_highest_id ) + check for habtm and automaticaly do a backup. + + config management + +================================================================================ + + + + + + + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +NEWSLETTER +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Add system mails to que + run on cron jobs to send in batches (cron is implemented but has errors) + track views with a image tag something like modelNames[0]; + + if ( !$id ) + { + $this->Session->setFlash( 'That '.$model.' could not be found', true ); + $this->redirect( $this->referer() ); + } + $this->$model->id = $id; + $this->$model->recursive = -1; + $__data = $this->$model->read(); + $__data[$model]['active'] = ( $__data[$model]['active'] ) ? 0 : 1; + + if ( $this->$model->save( $__data, array( 'validate' => false ) ) ) + { + $this->Session->setFlash( sprintf( __( 'The '.$model.' is now %s', true ), ( ( $__data[$model]['active'] ) ? __( 'active', true ) : __( 'disabled', true ) ) ) ); + $this->redirect( $this->referer() ); + } + + $this->Session->setFlash( 'That '.$model.' could not be toggled', true ); + $this->redirect( $this->referer() ); + } + + /** + * delete records. + * + * delete records throughout the app. + * + * @todo -cAppController Implement AppController. + * - make a confirm if the js box does not happen. eg open delete in new + * window there is no confirm, just delete. + * - undo thing... maybe save the whole record in the session and if click + * undo just save it back, or use soft delete and purge + * + * @param mixed $id the id of the record. + * @return n/a just redirects with different messages in {@see Session::setFlash} + */ + protected function admin_delete( $id = null ) + { + $model = $this->modelNames[0]; + + if ( !$id ) + { + $this->Session->setFlash( 'That '.$model.' could not be found', true ); + $this->redirect( $this->referer() ); + } + + if ( $this->$model->delete( $id ) ) + { + $this->Session->setFlash( __( 'The '.$model.' has been deleted', true ) ); + $this->redirect( array( 'action' => 'index' ) ); + } + } } ?> \ No newline at end of file diff --git a/app/app_helper.php b/app/app_helper.php new file mode 100644 index 000000000..8645f1f20 --- /dev/null +++ b/app/app_helper.php @@ -0,0 +1,276 @@ +params['prefix'], + $view->params['plugin'], + $view->name + ); + + return implode( $seperator, $breadcrumbs ); + } + + /** + * switch the class for table rows + * + * @param integer $i the number of the row + * @param string $class1 class 1 highlight + * @param string $class2 class 2 highlight + * @return string the class + */ + function rowClass( $class1 = 'bg', $class2 = '' ) + { + return ( ( $this->rowClassCounter++ % 2 ) ? $class1 : $class2 ); + } + + function adminPageHead( $view ) + { + if ( empty( $view ) ) + { + return false; + } + + return '

'.__( $view->name, true ).'

'. + '
'; + } + + /** + * creates table headers for admin. + * + * if the format is just array( 'head1', 'head2' ... ) it will output a + * normal table with TH that have no classes/styles applied. you can + * also pass things like array ( 'head1' => array( 'class' => 'something' ) ) + * to get out put like head1 + * + * @param array $data an array of items for the head. + */ + function adminTableHeader( $data ) + { + $out = ''; + foreach( $data as $field => $params ) + { + $atributes = ''; + + if ( is_int( $field ) && !is_array( $params ) ) + { + $field = $params; + $params = ''; + } + + else + { + + foreach( $params as $type => $param ) + { + $atributes = ''; + $atributes .= $type.'="'.$param.'" '; + } + + $atributes .= $atributes; + } + + if ( $atributes != '' ) + { + $params = $atributes; + } + + $out .= ''.$field.''; + } + $out .= ''; + + return $out; + } + + /** + * creates the header images for the admin table headers. + */ + function adminTableHeadImages() + { + + return $this->Html->image( + 'admin/bg-th-left.gif', + array( + 'width' => '8px', + 'height' => '7px', + 'class' => 'left' + ) + ). + $this->Html->image( + 'admin/bg-th-right.gif', + array( + 'width' => '8px', + 'height' => '7px', + 'class' => 'right' + ) + ); + } + + function adminIndexHead( $view = array(), $pagintion = array() ) + { + if ( empty( $view ) ) + { + $this->errors[] = 'I need the view.'; + return false; + } + + $out = '
'; + $out .= $this->adminPageHead( $view ); + $out .= '
'; + $out .= $this->Html->link( + 'Add', + array( + 'action' => 'add' + ) + ); + $out .= '
'; + $out .= '
'; + + return $out; + } + + function adminOtherHead( $view = array() ) + { + if ( empty( $view ) ) + { + $this->errors[] = 'I need the view.'; + return false; + } + + $out = '
'; + $out .= $this->adminPageHead( $view ); + $out .= '
'; + $out .= $this->Html->link( + 'Index', + array( + 'action' => 'index' + ) + ).' '; + $out .= $this->Html->link( + 'Add', + array( + 'action' => 'add' + ) + ); + $out .= '
'; + $out .= '
 
'; + + return $out; + } + + function ordering( $id = null, $order = null ) + { + if ( !$id ) + { + $this->errors[] = 'You need an id to move something'; + return false; + } + + if ( !$order ) + { + $this->errors[] = 'The order was not passed'; + } + $out = $order.' '; + + $out .= $this->Html->link( + $this->Html->image( + 'core/icons/actions/16/arrow-up-yes.png' + ), + array( + 'action' => 'reorder', + $id, + 'direction' => 'up', + 'amount' => 1 + ), + array( + 'escape' => false, + 'title' => __( 'Move up', true ), + 'alt' => __( 'Up', true ) + ) + ); + + $out .= $this->Html->link( + $this->Html->image( + 'core/icons/actions/16/arrow-down-yes.png' + ), + array( + 'action' => 'reorder', + $id, + 'direction' => 'down', + 'amount' => 1 + ), + array( + 'escape' => false, + 'title' => __( 'Move down', true ), + 'alt' => __( 'Down', true ) + ) + ); + + return $out; + } + + function paginationCounter( $pagintion ) + { + if ( empty( $pagintion ) ) + { + $this->errors[] = 'You did not pass the pagination object.'; + return false; + } + + $out = ''; + $out .= $pagintion->counter( array( 'format' => __( $this->paginationCounterFormat, true ) ) ); + $out .= ''; + + return $out; + } + + var $wysiwyg = 'fck'; + + function wysiwyg( $id = null, $toolbar = 'Basic' ) + { + if ( !$id ) + { + $this->errors[] = 'No field specified for the wysiwyg editor'; + return false; + } + + if ( !Configure::read( 'Wysiwyg.editor' ) ) + { + $this->errors[] = 'There is no editor configured'; + return false; + } + + $editor = ( Configure::read( 'Wysiwyg.editor' ) ) ? Configure::read( 'Wysiwyg.editor' ) : 'text'; + + return $this->Wysiwyg->$editor( $id, $toolbar ); + } + } +?> \ No newline at end of file diff --git a/app/app_model.php b/app/app_model.php index 4dd1bc0db..c693b2fbc 100644 --- a/app/app_model.php +++ b/app/app_model.php @@ -3,8 +3,164 @@ * * */ + /** + * AppModel + * + * @package + * @author dogmatic + * @copyright Copyright (c) 2009 + * @version $Id$ + * @access public + */ class AppModel extends Model { var $actsAs = array( 'Containable' ); + + + function lock( $fields = null, $id = null ) + { + $old_recursive = $this->recursive; + + $this->recursive = -1; + $data = parent::read( array( 'locked', 'locked_by', 'id' ), $id ); + + $this->Session = new CakeSession(); + + if ( $data[$this->name]['locked'] && $data[$this->name]['locked_by'] != $this->Session->read( 'Auth.User.id' ) ) + { + return false; + } + + $data[$this->name]['locked'] = 1; + $data[$this->name]['locked_by'] = $this->Session->read( 'Auth.User.id' ); + $data[$this->name]['locked_since'] = date( 'Y-m-d H:i:s' ); + + parent::save( $data, array( 'validation' => false ) ); + + $this->recursive = $old_recursive; + $data = $this->read( $fields, $id ); + return $data; + } + + /** + * For unlocking records. + * + * sets the lock to false and sets the date and person to null + * + * @param array $data + * @param array $options + * @return {@see Model::save} + */ + function save( $data = null, $validate = true, $fieldList = array() ) + { + $data[$this->name]['locked'] = 0; + $data[$this->name]['locked_by'] = null; + $data[$this->name]['locked_since'] = null; + + return parent::save( $data, $validate, $fieldList ); + } + + function find( $conditions = null, $fields = array(), $order = null, $recursive = null ) + { + switch( $conditions ) + { + case 'feed': + return $this->feedableFind( $this, $fields ); + break; + + default: + return parent::find( $conditions, $fields, $order, $recursive ); + } // switch + } + + + + function feedableFind(&$Model, $query) + { + if ( !isset( $query['feed'] ) ) + { + return $query; + } + + $sql = 'SELECT '; + if ( isset( $query['setup'] ) ) + { + $fields = array(); + + foreach( $query['setup'] as $name => $value ) + { + $fields[] = "'$value' AS $name"; + } + + $sql .= implode( ', ', $fields ); + } + + if ( isset( $query['fields'] ) ) + { + $_fields = array(); + + foreach( $query['fields'] as $field ) + { + $__fields = explode( '.', $field ); + $_fields[] = $__fields[1]; + } + + $sql .= ', '.implode( ', ', $_fields ); + } + + $sql .= ' FROM '.$Model->useDbConfig.'_'.$Model->useTable; + + if ( isset( $query['feed'] ) ) + { + foreach( $query['feed'] as $key => $feed ) + { + $sql .= ' UNION SELECT '; + if ( isset( $feed['setup'] ) ) + { + $fields = array(); + + foreach( $feed['setup'] as $name => $value ) + { + $fields[] = "'$value' AS $name"; + } + + $sql .= implode( ', ', $fields ); + } + + if ( isset( $feed['fields'] ) ) + { + $_fields = array(); + + foreach( $feed['fields'] as $field ) + { + $__fields = explode( '.', $field ); + $_fields[] = $__fields[1]; + } + + $sql .= ', '.implode( ', ', $_fields ); + } + + $__key = explode( '.', $key ); + $__key[0] = strtolower( $__key[0] ); + $__key[1] = strtolower( Inflector::pluralize( $__key[1] ) ); + + $sql .= ' FROM '.implode( '_', $__key ); + } + } + + if ( isset( $query['order'] ) ) + { + $ordering = array(); + + foreach( $query['order'] as $key => $value ) + { + $ordering[] = $key.' '.$value; + } + + $sql .= ' ORDER BY '.implode( ', ', $ordering ); + } + + return $this->query( $sql ); + } } ?> \ No newline at end of file diff --git a/app/config/acl.ini.php b/app/config/acl.ini.php new file mode 100644 index 000000000..35ec18662 --- /dev/null +++ b/app/config/acl.ini.php @@ -0,0 +1,70 @@ +; +; SVN FILE: $Id$ +;/** +; * Short description for file. +; * +; * +; * PHP versions 4 and 5 +; * +; * CakePHP(tm) : Rapid Development Framework http://cakephp.org/ +; * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) +; * +; * Licensed under The MIT License +; * Redistributions of files must retain the above copyright notice. +; * +; * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) +; * @link http://cakephp.org CakePHP(tm) Project +; * @package cake +; * @subpackage cake.app.config +; * @since CakePHP(tm) v 0.10.0.1076 +; * @license MIT License (http://www.opensource.org/licenses/mit-license.php) +; */ + +; 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/app/config/bootstrap.php b/app/config/bootstrap.php new file mode 100644 index 000000000..bdcdf6f2b --- /dev/null +++ b/app/config/bootstrap.php @@ -0,0 +1,52 @@ + array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), + * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), + * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), + * 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), + * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), + * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), + * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), + * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), + * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), + * 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), + * 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/') + * )); + * + */ + +/** + * As of 1.3, additional rules for the inflector are added below + * + * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); + * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); + * + */ + +?> \ No newline at end of file diff --git a/app/config/core.php b/app/config/core.php new file mode 100644 index 000000000..36ec07a74 --- /dev/null +++ b/app/config/core.php @@ -0,0 +1,293 @@ +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/.php. + * Set the value of 'Session.save' to to utilize it in CakePHP. + * + * To use database sessions, run the app/config/schema/sessions.php schema using + * the cake shell command: cake schema run create Sessions + * + */ + Configure::write('Session.save', 'php'); + +/** + * The model name to be used for the session model. + * + * 'Session.save' must be set to 'database' in order to utilize this constant. + * + * The model name set here should *not* be used elsewhere in your application. + */ + Configure::write('Session.model', 'Session'); + +/** + * 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. + * + * Please note that if you set a value for Session.model (above), any value set for + * Session.table will be ignored. + * + * [Note: Session.table is deprecated as of CakePHP 1.3] + */ + //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', 'core'); + +/** + * 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', 'medium'); + +/** + * A random string used in security hashing methods. + */ + Configure::write('Security.salt', 'dev-DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'); + +/** + * Apply timestamps with the last modified time to static assets (js, css, images). + * Will append a querystring parameter containing the time the file was modified. This is + * useful for invalidating browser caches. + * + * Set to `true` to apply timestamps, when debug = 0, or set to 'force' to always enable + * timestamping. + */ + //Configure::write('Asset.timestamp', true); +/** + * 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'); + +/** + * If you are on PHP 5.3 uncomment this line and correct your server timezone + * to fix the date & time related errors. + */ + //date_default_timezone_set('UTC'); + +/** + * + * 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/app/config/database.php b/app/config/database.php new file mode 100644 index 000000000..b08e02c51 --- /dev/null +++ b/app/config/database.php @@ -0,0 +1,136 @@ + 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. Uses database default. + * + */ +class DATABASE_CONFIG { + + var $default = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'root', + 'password' => 'root', + 'database' => 'phpdev', + 'prefix' => '', + ); + + var $test = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'user', + 'password' => 'password', + 'database' => 'test_database_name', + 'prefix' => '', + ); + + var $blog = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'root', + 'password' => 'root', + 'database' => 'phpdev', + 'prefix' => 'blog_', + ); + + var $cms = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'root', + 'password' => 'root', + 'database' => 'phpdev', + 'prefix' => 'cms_', + ); + + var $core = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'root', + 'password' => 'root', + 'database' => 'phpdev', + 'prefix' => 'core_', + ); + + var $newsletter = array( + 'driver' => 'mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'root', + 'password' => 'root', + 'database' => 'phpdev', + 'prefix' => 'newsletter_', + ); +} +?> \ No newline at end of file diff --git a/app/config/geshi.php b/app/config/geshi.php new file mode 100644 index 000000000..b48c49105 --- /dev/null +++ b/app/config/geshi.php @@ -0,0 +1,17 @@ +set_header_type(GESHI_HEADER_NONE); + $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2); + $geshi->enable_classes(); + $geshi->set_tab_width(4); + + +?> \ No newline at end of file diff --git a/app/config/routes.php b/app/config/routes.php new file mode 100644 index 000000000..c76ca002d --- /dev/null +++ b/app/config/routes.php @@ -0,0 +1,62 @@ + 'pages', 'action' => 'display', 'home')); +/** + * ...and connect the rest of 'Pages' controller's urls. + */ + Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); + + + + + + /** + * management routes + */ + Router::connect('/admin', array( 'plugin' => 'management', 'controller' => 'management', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true ) ); + Router::connect('/admin/management', array( 'plugin' => 'management', 'controller' => 'management', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true ) ); + + /** + * blog routes + */ + Router::connect('/admin/blog', array( 'plugin' => 'blog', 'controller' => 'posts', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true ) ); + Router::connect('/blog', array( 'plugin' => 'blog', 'controller' => 'posts' ) ); + + /** + * newsletter routes + */ + Router::connect('/admin/newsletter', array( 'plugin' => 'newsletter', 'controller' => 'newsletters', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true ) ); + Router::connect('/newsletter', array( 'plugin' => 'newsletter', 'controller' => 'newsletters' ) ); + + /** + * cms routes + */ + Router::connect('/admin/cms', array( 'plugin' => 'cms', 'controller' => 'sections', 'action' => 'dashboard', 'prefix' => 'admin', 'admin' => true ) ); + Router::connect('/cms', array( 'plugin' => 'cms', 'controller' => 'contentFrontpages' ) ); +?> \ No newline at end of file diff --git a/app/config/schema/db_acl.php b/app/config/schema/db_acl.php new file mode 100644 index 000000000..9e90d4356 --- /dev/null +++ b/app/config/schema/db_acl.php @@ -0,0 +1,74 @@ + 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/app/config/schema/i18n.php b/app/config/schema/i18n.php new file mode 100644 index 000000000..0ca2ec4c2 --- /dev/null +++ b/app/config/schema/i18n.php @@ -0,0 +1,51 @@ + 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/app/config/schema/sessions.php b/app/config/schema/sessions.php new file mode 100644 index 000000000..8ef270808 --- /dev/null +++ b/app/config/schema/sessions.php @@ -0,0 +1,48 @@ + 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/app/libs/cronjobs/%2Fadmin%2Fnewsletter%2Fnewsletters%2Findex.job b/app/libs/cronjobs/%2Fadmin%2Fnewsletter%2Fnewsletters%2Findex.job new file mode 100644 index 000000000..e69de29bb diff --git a/app/libs/cronjobs/cron.job b/app/libs/cronjobs/cron.job new file mode 100644 index 000000000..e69de29bb diff --git a/app/libs/cronjobs/cron.log b/app/libs/cronjobs/cron.log new file mode 100644 index 000000000..360fb5784 --- /dev/null +++ b/app/libs/cronjobs/cron.log @@ -0,0 +1,4 @@ +Sat, 12 Dec 2009 16:10:22 +0200 Running 5 * * * * /admin/newsletter/newsletters/index # make user cleanu every sunday at 5 am +Sat, 12 Dec 2009 16:10:22 +0200 Last run: Thu, 01 Jan 1970 02:00:00 +0200 +Sat, 12 Dec 2009 16:10:22 +0200 Last scheduled: Thu, 01 Jan 1970 02:05:00 +0200 +Sat, 12 Dec 2009 16:10:22 +0200 Completed 5 * * * * /admin/newsletter/newsletters/index # make user cleanu every sunday at 5 am diff --git a/app/libs/cronjobs/crontab.txt b/app/libs/cronjobs/crontab.txt new file mode 100644 index 000000000..b4375319f --- /dev/null +++ b/app/libs/cronjobs/crontab.txt @@ -0,0 +1,7 @@ +#comments start with '#' +#mi h d m dow job comment +#0 5 * * Sun /users/cleanup # make user cleanu every sunday at 5 am +#40 5 2 * * /posts/makeIndex #build an index of your posts +#*/15 8-19 * * Mon-Fri /emails/send # Send emails + +5 * * * * /admin/newsletter/newsletters/index # make user cleanu every sunday at 5 am \ No newline at end of file diff --git a/app/vendors/geshi/contrib/aliased.php b/app/vendors/geshi/contrib/aliased.php new file mode 100644 index 000000000..32bec9239 --- /dev/null +++ b/app/vendors/geshi/contrib/aliased.php @@ -0,0 +1,124 @@ + + * @version $Id: aliased.php 785 2006-07-19 10:09:45Z oracleshinoda $ + */ + +// Your config here +define("SOURCE_ROOT", "/var/www/your/source/root/"); + +// Assume you've put geshi in the include_path already +require_once("geshi.php"); + +// Get path info +$path = SOURCE_ROOT.$_SERVER['PATH_INFO']; + +// Check for dickheads trying to use '../' to get to sensitive areas +$base_path_len = strlen(SOURCE_ROOT); +$real_path = realpath($path); +if(strncmp($real_path, SOURCE_ROOT, $base_path_len)) { + exit("Stop that."); +} + +// Check file exists +if(!file_exists($path)) { + exit("File not found ($path)."); +} + +// Gather contents +$contents = file_get_contents($path); + +// Prepare GeSHi instance +$geshi =& new GeSHi($contents, "PHP"); +$geshi->set_header_type(GESHI_HEADER_PRE); +$geshi->enable_classes(); +$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10); +$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true); +$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true); +$geshi->set_code_style('color: #000020;', 'color: #000020;'); +$geshi->set_link_styles(GESHI_LINK, 'color: #000060;'); +$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;'); +$geshi->set_header_content('Source code viewer'); +$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;'); +$geshi->set_footer_content('Parsed in