diff --git a/app/views/layouts/default.thtml b/app/views/layouts/default.thtml index b5f156897..a4323b652 100644 --- a/app/views/layouts/default.thtml +++ b/app/views/layouts/default.thtml @@ -2,8 +2,8 @@ <?=$title_for_layout?> - - + charsetTag('UTF-8')?> + cssTag('default')?> diff --git a/config/routes.php b/config/routes.php index f7b70d620..687d62042 100644 --- a/config/routes.php +++ b/config/routes.php @@ -48,6 +48,6 @@ $Route->connect ('/test', array('controller'=>'Tests', 'action'=>'test_all')); * Now we connect the rest of Pages controller's urls * This needs to be the last one, as it takes in any and all remaining urls */ -$Route->connect ('/*', array('controller'=>'Pages', 'action'=>'view')); +$Route->connect ('/pages/*', array('controller'=>'Pages', 'action'=>'view')); ?> \ No newline at end of file diff --git a/config/routes.php.default b/config/routes.php.default index 86ac906e0..70211c610 100644 --- a/config/routes.php.default +++ b/config/routes.php.default @@ -44,4 +44,9 @@ $Route->connect ('/', array('controller'=>'Pages', 'action'=>'index')); */ $Route->connect ('/test', array('controller'=>'Tests', 'action'=>'test_all')); +/** + * Now we connect the rest of Pages controller's urls + * This needs to be the last one, as it takes in any and all remaining urls + */ +$Route->connect ('/pages/*', array('controller'=>'Pages', 'action'=>'view')); ?> \ No newline at end of file diff --git a/config/tags.php b/config/tags.php index b580ff3c5..ac3782beb 100644 --- a/config/tags.php +++ b/config/tags.php @@ -125,4 +125,14 @@ define('TAG_TABLE_CELL', '%s'); */ define('TAG_TABLE_ROW', '%s'); +/** + * Tag template for a CSS meta-tag. + */ +define('TAG_CSS', ''); + +/** + * Tag template for a charset meta-tag. + */ +define('TAG_CHARSET', ''); + ?> diff --git a/libs/basics.php b/libs/basics.php index 32ee4e888..9cf5afc7a 100644 --- a/libs/basics.php +++ b/libs/basics.php @@ -238,7 +238,7 @@ class NeatArray { * @access public * @uses NeatArray::value */ - function NeatArray ($value) { + function NeatArray ($value=array()) { $this->value = $value; } @@ -277,6 +277,73 @@ class NeatArray { } $this->value = $out; } + + + /** + * Adds elements from the supplied array to itself. + * + * @param string $array + * @return bool + * @access public + * @uses NeatArray::value + */ + function add ($value) { + return ($this->value = $this->plus($value))? true: false; + } + + + /** + * Returns itself merged with supplied array. + * + * @param string $array + * @return array + * @access public + * @uses NeatArray::value + */ + function plus ($value) { + return array_merge($this->value, (is_array($value)? $value: array($value))); + } + + /** + * Counts repeating words. + * + * @param int $sortedBy 1 sorts by values, 2 by keys, default null (no sort) + * @return array + * @access public + * @uses NeatArray::value + */ + function totals ($sortedBy=1,$reverse=true) { + $out = array(); + foreach ($this->value as $val) + isset($out[$val])? $out[$val]++: $out[$val] = 1; + + if ($sortedBy == 1) { + $reverse? arsort($out, SORT_NUMERIC): asort($out, SORT_NUMERIC); + } + + if ($sortedBy == 2) { + $reverse? krsort($out, SORT_STRING): ksort($out, SORT_STRING); + } + + return $out; + } + + function filter ($with) { + return $this->value = array_filter($this->value, $with); + } + + /** + * Passes each of it's values thrue a specified function or method. + * + * @return array + * @access public + * @uses NeatArray::value + */ + function walk ($with) { + array_walk($this->value, $with); + return $this->value; + } + } ?> diff --git a/libs/dbo.php b/libs/dbo.php index eee5aa232..161572114 100644 --- a/libs/dbo.php +++ b/libs/dbo.php @@ -325,7 +325,7 @@ class DBO extends Object { } /** - * Enter description here... + * Checks if it's connected to the database * * @return unknown */ @@ -334,7 +334,7 @@ class DBO extends Object { } /** - * Enter description here... + * Prepares an array of data values by quoting them etc. * * @return unknown */ diff --git a/libs/dbo_factory.php b/libs/dbo_factory.php index ce7bca60b..f1571f595 100644 --- a/libs/dbo_factory.php +++ b/libs/dbo_factory.php @@ -33,6 +33,7 @@ * */ uses('object'); +config('database'); /** * Enter description here... diff --git a/libs/error_messages.php b/libs/error_messages.php index e623e1ee5..8f2b48894 100644 --- a/libs/error_messages.php +++ b/libs/error_messages.php @@ -41,6 +41,12 @@ define ('ERROR_UNKNOWN_DATABASE_DRIVER', '[DbFactory] Specified database driver */ define ('ERROR_NO_CONTROLLER_SET', '[Dispatcher] No default controller, can\'t continue, check routes config'); +/** + * Enter description here... + * + */ +define ('ERROR_NO_ACTION_SET', '[Dispatcher] No default action, can\'t continue, check routes config'); + /** * Enter description here... * diff --git a/libs/flay.php b/libs/flay.php index 706ba7f95..8c980846c 100644 --- a/libs/flay.php +++ b/libs/flay.php @@ -78,9 +78,12 @@ class Flay extends Object { * @param unknown_type $text * @return unknown */ - function toHtml ($text=null) { + function toHtml ($text=null, $stripTags=false) { $text = $text? $text: $this->text; + if ($stripTags) + $text = strip_tags($text); + // trim whitespace and disable all HTML $text = str_replace('<', '<', str_replace('>', '>', trim($text))); diff --git a/libs/model.php b/libs/model.php index 39aa92e8f..9bfcb66d6 100644 --- a/libs/model.php +++ b/libs/model.php @@ -263,12 +263,14 @@ class Model extends Object { } /** - * Enter description here... + * Reads table info (column names and types) from the db * + * @return array */ function loadInfo () { if (empty($this->_table_info)) $this->_table_info = new NeatArray($this->db->fields($this->table)); + return $this->_table_info; } /** diff --git a/logs/put_logs_here b/logs/put_logs_here new file mode 100644 index 000000000..e69de29bb