Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Consolidate date formats and column names

We had some unix timestamps and some datetime fields, some called created_at and some called created_on. Now its all datetime, created_at (non-null) and updated_at (nullable).
  • Loading branch information...
commit cf29cbb7a10f5999d9d5a9cc5c03760dbbdb6715 1 parent f297dda
Phil Sturgeon philsturgeon authored
Showing with 1,229 additions and 357 deletions.
  1. +1 −1  addons/shared_addons/themes/base/views/modules/blog/archive.php
  2. +1 −1  addons/shared_addons/themes/base/views/modules/blog/posts.php
  3. +1 −1  addons/shared_addons/themes/base/views/modules/blog/tagged.php
  4. +1 −1  addons/shared_addons/themes/base/views/modules/blog/view.php
  5. +1 −1  installer/controllers/installer.php
  6. +13 −1 installer/libraries/Installer_lib.php
  7. +3 −1 installer/libraries/Module_import.php
  8. +13 −10 installer/models/install_m.php
  9. +18 −0 system/cms/migrations/137_Make_field_name_nullable.php
  10. +3 −3 system/cms/modules/addons/src/Pyro/Module/Addons/ModuleManager.php
  11. +1 −1  system/cms/modules/addons/src/Pyro/Module/Addons/ModuleModel.php
  12. +154 −153 system/cms/modules/addons/src/Pyro/Module/Addons/ThemeManager.php
  13. +14 −14 system/cms/modules/addons/src/Pyro/Module/Addons/WidgetInstanceModel.php
  14. +1 −1  system/cms/modules/addons/src/Pyro/Module/Addons/WidgetModel.php
  15. +3 −3 system/cms/modules/blog/controllers/admin.php
  16. +12 −12 system/cms/modules/blog/models/blog_m.php
  17. +5 −5 system/cms/modules/blog/plugin.php
  18. +3 −3 system/cms/modules/blog/views/admin/form.php
  19. +3 −3 system/cms/modules/blog/views/admin/form/tabs/options.php
  20. +1 −1  system/cms/modules/blog/views/archive.php
  21. +1 −1  system/cms/modules/blog/views/posts.php
  22. +1 −1  system/cms/modules/blog/views/view.php
  23. +1 −1  system/cms/modules/comments/controllers/admin.php
  24. +0 −1  system/cms/modules/comments/controllers/comments.php
  25. +1 −1  system/cms/modules/comments/details.php
  26. +3 −3 system/cms/modules/comments/src/Pyro/Module/Comments/Model/Comment.php
  27. +1 −1  system/cms/modules/comments/views/admin/preview.php
  28. +1 −1  system/cms/modules/comments/views/admin/tables/comments.php
  29. +1 −1  system/cms/modules/comments/views/display.php
  30. +16 −20 system/cms/modules/pages/controllers/admin.php
  31. +2 −2 system/cms/modules/pages/controllers/pages.php
  32. +35 −33 system/cms/modules/pages/controllers/sitemap.php
  33. +10 −9 system/cms/modules/pages/details.php
  34. +4 −4 system/cms/modules/pages/plugin.php
  35. +3 −3 system/cms/modules/search/details.php
  36. +1 −1  system/cms/modules/search/src/Pyro/Module/Search/Model/Search.php
  37. +303 −0 system/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/BlogsBlogEntryModel.php
  38. +65 −0 system/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/PagesDefPageFieldsEntryModel.php
  39. +395 −0 system/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/UsersProfilesEntryModel.php
  40. +90 −0 system/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/VariablesVariablesEntryModel.php
  41. +2 −18 system/cms/modules/streams_core/models/fields_m.php
  42. +2 −6 system/cms/modules/streams_core/models/streams_m.php
  43. +11 −2 system/cms/modules/streams_core/src/Pyro/Module/Streams/Entry/EntryModel.php
  44. +4 −4 system/cms/modules/streams_core/src/Pyro/Module/Streams/Field/FieldAssignmentModel.php
  45. +4 −1 system/cms/modules/streams_core/src/Pyro/Module/Streams/Field/FieldModel.php
  46. +2 −6 system/cms/modules/users/controllers/admin.php
  47. +8 −5 system/cms/modules/users/details.php
  48. +3 −8 system/cms/modules/users/src/Pyro/Module/Users/Model/User.php
  49. +1 −1  system/cms/modules/users/views/admin/users/tables/users.php
  50. +0 −1  system/cms/modules/widgets/controllers/admin.php
  51. +4 −4 system/cms/modules/widgets/details.php
  52. +1 −1  system/cms/plugins/user.php
  53. +1 −1  system/cms/themes/pyrocms/views/admin/dashboard.php
2  addons/shared_addons/themes/base/views/modules/blog/archive.php
View
@@ -9,7 +9,7 @@
<div class="post_date">
<span class="date">
{{ theme:image file="date.png" }}
- About {{ helper:timespan timestamp=created_on }} ago.
+ About {{ helper:timespan timestamp=created_at }} ago.
</span>
</div>
2  addons/shared_addons/themes/base/views/modules/blog/posts.php
View
@@ -9,7 +9,7 @@
<div class="post_date">
<span class="date">
{{ theme:image file="date.png" }}
- About {{ helper:timespan timestamp=created_on }} ago.
+ About {{ helper:timespan timestamp=created_at }} ago.
</span>
</div>
2  addons/shared_addons/themes/base/views/modules/blog/tagged.php
View
@@ -9,7 +9,7 @@
<div class="post_date">
<span class="date">
{{ theme:image file="date.png" }}
- About {{ helper:timespan timestamp=created_on }} ago.
+ About {{ helper:timespan timestamp=created_at }} ago.
</span>
</div>
2  addons/shared_addons/themes/base/views/modules/blog/view.php
View
@@ -8,7 +8,7 @@
<div class="post_date">
<span class="date">
{{ theme:image file="date.png" }}
- About {{ helper:timespan timestamp=created_on }} ago.
+ About {{ helper:timespan timestamp=created_at }} ago.
</span>
</div>
2  installer/controllers/installer.php
View
@@ -428,7 +428,7 @@ public function step_4()
// Let's try to install the system with this new PDO instance
try {
$pdb = $this->installer_lib->install($user, $db_config);
- } catch (Exception $e) {
+ } catch (InstallerException $e) {
$this->_render_view('step_4', array(
'messages' => array(
14 installer/libraries/Installer_lib.php
View
@@ -169,7 +169,19 @@ public function create_connection($config)
*/
public function create_db(PDO $conn, $database)
{
- return $conn->query("CREATE DATABASE {$database}");
+ try {
+ return $conn->query("CREATE DATABASE {$database}");
+ } catch (PDOException $e) {
+
+ // PostgreSQL says this is a duplicate database
+ if ($e->getCode() === '42P04') {
+ // If this table already exists then great, our work here is done
+ return true;
+ } else {
+ // Unkown issue creating the table
+ throw new InstallerException("Unkown issue creating the database: ".$e->getMessage());
+ }
+ }
}
/**
4 installer/libraries/Module_import.php
View
@@ -153,7 +153,8 @@ public function add($module)
'menu' => ! empty($module['menu']) ? $module['menu'] : false,
'enabled' => (bool) $module['enabled'],
'installed' => (bool) $module['installed'],
- 'is_core' => (bool) $module['is_core']
+ 'is_core' => (bool) $module['is_core'],
+ 'created_at' => date('Y-m-d H:i:s'),
)
);
}
@@ -204,6 +205,7 @@ public function import_all()
'last_name' => $user['lastname'],
'display_name' => $user['firstname'].' '.$user['lastname'],
'lang' => 'en',
+ 'created_at' => date('Y-m-d H:i:s'),
));
// After modules are imported we need to modify the settings table
23 installer/models/install_m.php
View
@@ -64,8 +64,8 @@ public function set_default_structure(Connection $conn, array $user, array $db)
$table->string('ref', 20);
$table->string('domain', 100);
$table->boolean('is_activated')->default(true);
- $table->integer('created_on');
- $table->integer('updated_on')->nullable();
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
$table->unique('ref');
$table->unique('domain');
@@ -85,9 +85,9 @@ public function set_default_structure(Connection $conn, array $user, array $db)
$table->string('activation_code')->nullable();
$table->string('persist_code')->nullable();
$table->string('reset_password_code')->nullable();
- $table->integer('created_on');
- $table->integer('updated_on')->nullable();
- $table->integer('last_login')->nullable();
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
+ $table->dateTime('last_login')->nullable();
$table->unique('email');
$table->unique('username');
@@ -105,7 +105,7 @@ public function set_default_structure(Connection $conn, array $user, array $db)
'password' => $password,
'ip_address' => $this->input->ip_address(),
'is_activated'=> true,
- 'created_on' => time(),
+ 'created_at' => date('Y-m-d H:i:s'),
);
// Create User tables
@@ -177,7 +177,8 @@ public function set_default_structure(Connection $conn, array $user, array $db)
$table->boolean('enabled');
$table->boolean('installed');
$table->boolean('is_core');
- $table->integer('updated_on')->nullable();
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
$table->unique('slug');
$table->index('enabled');
@@ -200,8 +201,8 @@ public function set_default_structure(Connection $conn, array $user, array $db)
$table->string('type')->nullable();
$table->boolean('enabled')->default(true);
$table->integer('order')->default(0);
- $table->integer('created_on');
- $table->integer('updated_on')->nullable();
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
});
$schema->dropIfExists('theme_options');
@@ -266,6 +267,8 @@ public function set_default_structure(Connection $conn, array $user, array $db)
$table->text('field_data')->nullable();
$table->text('view_options')->nullable();
$table->enum('locked', array('yes', 'no'))->default('no');
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
});
// Assignments Table
@@ -279,7 +282,7 @@ public function set_default_structure(Connection $conn, array $user, array $db)
$table->enum('required', array('yes', 'no'))->default('no');
$table->enum('unique', array('yes', 'no'))->default('no');
$table->text('instructions')->nullable();
- $table->string('field_name', 60);
+ $table->string('field_name', 60)->nullable();
// $table->foreign('stream_id'); //TODO Set up foreign keys
// $table->foreign('field_id'); //TODO Set up foreign keys
18 system/cms/migrations/137_Make_field_name_nullable.php
View
@@ -0,0 +1,18 @@
+<?php defined('BASEPATH') or exit('No direct script access allowed');
+
+class Migration_Make_field_name_nullable extends CI_Migration
+{
+ public function up()
+ {
+ $prefix = ci()->pdb->getQueryGrammar()->getTablePrefix();
+
+ ci()->pdb->statement("ALTER TABLE `" . $prefix . "_data_field_assignments` MODIFY `field_name` VARCHAR(60);");
+
+ return true;
+ }
+
+ public function down()
+ {
+ return true;
+ }
+}
6 system/cms/modules/addons/src/Pyro/Module/Addons/ModuleManager.php
View
@@ -156,7 +156,7 @@ public function get($slug)
'current_version' => $this->version($record->slug),
'path' => $location,
'field_types' => ! empty($info['field_types']) ? $info['field_types'] : false,
- 'updated_on' => $record->updated_on
+ 'updated_at' => $record->updated_at
);
}
@@ -227,7 +227,7 @@ public function getAll($params = null, $return_disabled = true, $fresh = true)
'current_version' => $this->version($record->slug),
'path' => $location,
'field_types' => ! empty($info['field_types']) ? $info['field_types'] : false,
- 'updated_on' => $record->updated_on
+ 'updated_at' => $record->updated_at
);
// store these
@@ -473,7 +473,7 @@ public function registerUnavailableModules()
'is_backend' => ! empty($input['backend']),
'skip_xss' => ! empty($input['skip_xss']),
'menu' => ! empty($input['menu']) ? $input['menu'] : false,
- 'updated_on' => time()
+ 'updated_at' => date('Y-m-d H:i:s')
));
log_message('debug', sprintf('The information of the module "%s" has been updated', $slug));
2  system/cms/modules/addons/src/Pyro/Module/Addons/ModuleModel.php
View
@@ -37,7 +37,7 @@ class ModuleModel extends Eloquent
*
* @var boolean
*/
- public $timestamps = false;
+ public $timestamps = true;
/**
* Find All
307 system/cms/modules/addons/src/Pyro/Module/Addons/ThemeManager.php
View
@@ -12,134 +12,134 @@
*/
class ThemeManager
{
- /**
- * Available Themes
- *
- * @var array
- */
- protected $exists = array();
-
- /**
- * Theme Locations
- *
- * @var array
- */
- protected $locations = array();
-
- /**
- * Constructor
- */
+ /**
+ * Available Themes
+ *
+ * @var array
+ */
+ protected $exists = array();
+
+ /**
+ * Theme Locations
+ *
+ * @var array
+ */
+ protected $locations = array();
+
+ /**
+ * Constructor
+ */
public function __construct()
{
$this->themes = new ThemeModel;
}
- /**
- * Set Locations
- */
- public function setLocations(array $locations)
- {
- $this->locations = $locations;
- }
-
- /**
- * Get Module
- *
- * @return Pyro\Module\Addons\ThemeModel
- */
- public function getModel()
- {
- return $this->themes;
- }
-
- /**
- * Locate
- *
- * @param string $slug
- *
- * @return bool|object
- */
- public function locate($slug)
- {
- if (count($this->locations) === 0) {
- throw new Exception('No locations have been set, so how can anything be found?');
- }
-
- foreach ($this->locations as $location) {
- if (is_dir($location.$slug)) {
- $theme = $this->readDetails($location, $slug);
-
- if ($theme !== false) {
- return $theme;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Get details about a theme
- *
- * @param $location
- * @param $slug
- *
- * @return array
- */
- protected function readDetails($location, $slug)
- {
- // If it exists already, use it
- if ( ! empty($this->exists[$slug])) {
- return $this->exists[$slug];
- }
-
- if ( ! (is_dir($path = $location.$slug) and is_file($path.'/theme.php'))) {
- return false;
- }
-
- //path to theme
- $web_path = $location.$slug;
-
- //load the theme details.php file
- $theme = $this->spawnClass($location, $slug);
-
- if (( ! $model = $this->themes->findBySlug($slug))) {
- throw new \Exception("Theme '{$slug}' does not exist!");
- }
-
- // Add some extra bits, that aren't in the DB
- $theme->model = $model;
- $theme->path = $path;
- $theme->web_path = $web_path;
- $theme->screenshot = $web_path.'/screenshot.png';
-
- return $theme;
- }
-
- /**
- * Spawn Class
- *
- * Checks to see if a details.php exists and returns a class
- *
+ /**
+ * Set Locations
+ */
+ public function setLocations(array $locations)
+ {
+ $this->locations = $locations;
+ }
+
+ /**
+ * Get Module
+ *
+ * @return Pyro\Module\Addons\ThemeModel
+ */
+ public function getModel()
+ {
+ return $this->themes;
+ }
+
+ /**
+ * Locate
+ *
+ * @param string $slug
+ *
+ * @return bool|object
+ */
+ public function locate($slug)
+ {
+ if (count($this->locations) === 0) {
+ throw new Exception('No locations have been set, so how can anything be found?');
+ }
+
+ foreach ($this->locations as $location) {
+ if (is_dir($location.$slug)) {
+ $theme = $this->readDetails($location, $slug);
+
+ if ($theme !== false) {
+ return $theme;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Get details about a theme
+ *
+ * @param $location
+ * @param $slug
+ *
+ * @return array
+ */
+ protected function readDetails($location, $slug)
+ {
+ // If it exists already, use it
+ if (! empty($this->exists[$slug])) {
+ return $this->exists[$slug];
+ }
+
+ if (! (is_dir($path = $location.$slug) and is_file($path.'/theme.php'))) {
+ return false;
+ }
+
+ //path to theme
+ $web_path = $location.$slug;
+
+ //load the theme details.php file
+ $theme = $this->spawnClass($location, $slug);
+
+ if (( ! $model = $this->themes->findBySlug($slug))) {
+ throw new \Exception("Theme '{$slug}' does not exist!");
+ }
+
+ // Add some extra bits, that aren't in the DB
+ $theme->model = $model;
+ $theme->path = $path;
+ $theme->web_path = $web_path;
+ $theme->screenshot = $web_path.'/screenshot.png';
+
+ return $theme;
+ }
+
+ /**
+ * Spawn Class
+ *
+ * Checks to see if a details.php exists and returns a class
+ *
* @param string $path The location of the theme (APPPATH, SHARED_PATH, etc)
- * @param string $slug The folder name of the theme
- *
- * @return array
- */
- private function spawnClass($path, $slug)
- {
- // Before we can install anything we need to know some details about the theme
- $details_file = "{$path}{$slug}/theme.php";
+ * @param string $slug The folder name of the theme
+ *
+ * @return array
+ */
+ private function spawnClass($path, $slug)
+ {
+ // Before we can install anything we need to know some details about the theme
+ $details_file = "{$path}{$slug}/theme.php";
- // Sweet, include the file
- require_once $details_file;
+ // Sweet, include the file
+ require_once $details_file;
- // Now call the details class
- $class = 'Theme_'.ucfirst(strtolower($slug));
+ // Now call the details class
+ $class = 'Theme_'.ucfirst(strtolower($slug));
- // Now we need to talk to it
- return new $class;
- }
+ // Now we need to talk to it
+ return new $class;
+ }
/**
* Discover Unavailable Themes
@@ -153,7 +153,7 @@ public function registerUnavailableThemes()
{
$known = $this->themes->findAll();
- $known_array = array();
+ $known_mtime = array();
// Loop through the known array and assign it to a single dimension because
// in_array can not search a multi array.
@@ -162,7 +162,7 @@ public function registerUnavailableThemes()
$known_mtime[$item->slug] = $item;
}
}
-
+
foreach ($this->locations as $location) {
// some servers return false instead of an empty array
if (( ! $temp_themes = glob($location.'*', GLOB_ONLYDIR))) {
@@ -177,7 +177,7 @@ public function registerUnavailableThemes()
// This didnt work out right at all. Bail on this one theme.
if ($theme_class === false or ! ($theme_class instanceof AbstractTheme)) {
continue;
- }
+ }
$this->register($theme_class, $slug);
}
@@ -187,7 +187,7 @@ public function registerUnavailableThemes()
}
/**
- * Register
+ * Register
*
* Read a theme from the file system and save it to the DB
*
@@ -198,36 +198,37 @@ public function registerUnavailableThemes()
*/
public function register(AbstractTheme $theme, $slug) {
- $record = false;
-
- if (! $this->themes->findBySlug($slug)) {
- // Looks like it installed ok, add a record
- $record = $this->themes->create(array(
- 'slug' => $slug,
- 'name' => $theme->name,
- 'author' => $theme->author,
- 'author_website' => $theme->author_website,
- 'website' => $theme->website,
- 'description' => $theme->description,
- 'version' => $theme->version,
- 'type' => $theme->type,
- ));
-
- if (is_array($theme->options)) {
- foreach ($theme->options as $key => $option) {
- $record->options()->create(array(
- 'slug' => $key,
- 'title' => $option['title'],
- 'description' => $option['description'],
- 'default' => $option['default'],
- 'value' => $option['default'],
- 'type' => $option['type'],
- 'options' => $option['options'],
- 'required' => $option['required'],
- ));
- }
- }
- }
+ $record = false;
+
+ if (! $this->themes->findBySlug($slug)) {
+ // Looks like it installed ok, add a record
+ $record = $this->themes->create(array(
+ 'slug' => $slug,
+ 'name' => $theme->name,
+ 'author' => $theme->author,
+ 'author_website' => $theme->author_website,
+ 'website' => $theme->website,
+ 'description' => $theme->description,
+ 'version' => $theme->version,
+ 'type' => $theme->type,
+ 'created_at' => $theme->created_at ?: date('Y-m-d H:i:s'),
+ ));
+
+ if (is_array($theme->options)) {
+ foreach ($theme->options as $key => $option) {
+ $record->options()->create(array(
+ 'slug' => $key,
+ 'title' => $option['title'],
+ 'description' => $option['description'],
+ 'default' => $option['default'],
+ 'value' => $option['default'],
+ 'type' => $option['type'],
+ 'options' => $option['options'],
+ 'required' => $option['required'],
+ ));
+ }
+ }
+ }
return $record;
}
28 system/cms/modules/addons/src/Pyro/Module/Addons/WidgetInstanceModel.php
View
@@ -30,14 +30,14 @@ class WidgetInstanceModel extends Eloquent
*
* @var array
*/
- protected $guarded = array('id', 'options', 'order', 'created_on', 'updated_on');
+ protected $guarded = array('id', 'options', 'order', 'created_at', 'updated_at');
/**
* Disable updated_at and created_at on table
*
* @var boolean
*/
- public $timestamps = false;
+ public $timestamps = true;
/**
* Relationship: Options
@@ -89,19 +89,19 @@ public function validate()
return ci()->form_validation->run();
}
- protected function setOptionsAttribute($value)
- {
- $this->attributes['options'] = serialize((array) $value);
- }
+ protected function setOptionsAttribute($value)
+ {
+ $this->attributes['options'] = serialize((array) $value);
+ }
- protected function getOptionsAttribute($options)
- {
- $options = (array) unserialize($options);
+ protected function getOptionsAttribute($options)
+ {
+ $options = (array) unserialize($options);
- if ( ! isset($options['show_title'])) {
- $options['show_title'] = false;
- }
+ if (! isset($options['show_title'])) {
+ $options['show_title'] = false;
+ }
- return $options;
- }
+ return $options;
+ }
}
2  system/cms/modules/addons/src/Pyro/Module/Addons/WidgetModel.php
View
@@ -37,7 +37,7 @@ class WidgetModel extends Eloquent
*
* @var boolean
*/
- public $timestamps = false;
+ public $timestamps = true;
/**
* Find By Slug
6 system/cms/modules/blog/controllers/admin.php
View
@@ -54,17 +54,17 @@ class Admin extends Admin_Controller
'rules' => 'trim|alpha'
),
array(
- 'field' => 'created_on',
+ 'field' => 'created_at',
'label' => 'lang:blog:date_label',
'rules' => 'trim|required'
),
array(
- 'field' => 'created_on_hour',
+ 'field' => 'created_at_hour',
'label' => 'lang:blog:created_hour',
'rules' => 'trim|numeric|required'
),
array(
- 'field' => 'created_on_minute',
+ 'field' => 'created_at_minute',
'label' => 'lang:blog:created_minute',
'rules' => 'trim|numeric|required'
),
24 system/cms/modules/blog/models/blog_m.php
View
@@ -15,7 +15,7 @@ public function get_all()
->join('blog_categories', 'blog.category_id = blog_categories.id', 'left')
->join('profiles', 'profiles.user_id = blog.author_id', 'left')
->join('users', 'blog.author_id = users.id', 'left')
- ->order_by('created_on', 'DESC');
+ ->order_by('created_at', 'DESC');
return $this->db->get('blog')->result();
}
@@ -58,11 +58,11 @@ public function get_many_by($params = array())
}
if ( ! empty($params['month'])) {
- $this->db->where('MONTH(FROM_UNIXTIME('.$this->db->dbprefix('blog').'.created_on))', $params['month']);
+ $this->db->where('MONTH('.$this->db->dbprefix('blog').'.created_at)', $params['month']);
}
if ( ! empty($params['year'])) {
- $this->db->where('YEAR(FROM_UNIXTIME('.$this->db->dbprefix('blog').'.created_on))', $params['year']);
+ $this->db->where('YEAR('.$this->db->dbprefix('blog').'.created_at)', $params['year']);
}
if ( ! empty($params['keywords'])) {
@@ -87,7 +87,7 @@ public function get_many_by($params = array())
// By default, dont show future posts
if ( ! isset($params['show_future']) || (isset($params['show_future']) && $params['show_future'] == false)) {
- $this->db->where('blog.created_on <=', now());
+ $this->db->where('blog.created_at <=', date('Y-m-d H:i:s'));
}
// Limit the results based on 1 number or 2 (2nd is offset)
@@ -140,11 +140,11 @@ public function count_by($params = array())
}
if ( ! empty($params['month'])) {
- $this->db->where('MONTH(FROM_UNIXTIME('.$this->db->dbprefix('blog').'.created_on))', $params['month']);
+ $this->db->where('MONTH('.$this->db->dbprefix('blog').'.created_at)', $params['month']);
}
if ( ! empty($params['year'])) {
- $this->db->where('YEAR(FROM_UNIXTIME('.$this->db->dbprefix('blog').'.created_on))', $params['year']);
+ $this->db->where('YEAR('.$this->db->dbprefix('blog').'.created_at)', $params['year']);
}
if ( ! empty($params['keywords'])) {
@@ -189,20 +189,20 @@ public function publish($id = 0)
public function get_archive_months()
{
- $this->db->select('UNIX_TIMESTAMP(DATE_FORMAT(FROM_UNIXTIME(t1.created_on), "%Y-%m-02")) AS `date`', false);
+ $this->db->select('DATE_FORMAT(t1.created_at), "%Y-%m-02") AS `date`', false);
$this->db->from('blog t1');
$this->db->distinct();
$this->db->select('(SELECT count(id) FROM '.$this->db->dbprefix('blog').' t2
- WHERE MONTH(FROM_UNIXTIME(t1.created_on)) = MONTH(FROM_UNIXTIME(t2.created_on))
- AND YEAR(FROM_UNIXTIME(t1.created_on)) = YEAR(FROM_UNIXTIME(t2.created_on))
+ WHERE MONTH(t1.created_at) = MONTH(t2.created_at)
+ AND YEAR(t1.created_at) = YEAR(t2.created_at)
AND status = "live"
- AND created_on <= '.now().'
+ AND created_at <= NOW()
) as post_count');
$this->db->where('status', 'live');
- $this->db->where('created_on <=', now());
+ $this->db->where('created_at <=', now());
$this->db->having('post_count >', 0);
- $this->db->order_by('t1.created_on DESC');
+ $this->db->order_by('t1.created_at DESC');
$query = $this->db->get();
return $query->result();
10 system/cms/modules/blog/plugin.php
View
@@ -37,7 +37,7 @@ public function _self_doc()
),
'single' => false,// single tag or double tag (tag pair)
'double' => true,
- 'variables' => 'category_title|category_slug|author_name|title|slug|url|category_id|intro|body|parsed|created_on|updated_on|count',// the variables available inside the double tags
+ 'variables' => 'category_title|category_slug|author_name|title|slug|url|category_id|intro|body|parsed|created_at|updated_on|count',// the variables available inside the double tags
'attributes' => array(// an array of all attributes
'category' => array(// the attribute name. If the attribute name is used give most common values as separate attributes
'type' => 'slug',// Can be: slug, number, flag, text, any. A flag is a predefined value.
@@ -60,7 +60,7 @@ public function _self_doc()
'order-by' => array(
'type' => 'column',
'flags' => '',
- 'default' => 'created_on',
+ 'default' => 'created_at',
'required' => false,
),
'order-dir' => array(
@@ -179,10 +179,10 @@ public function posts()
'stream' => 'blog',
'namespace' => 'blogs',
'where' => array("`status` = 'live'"),
- 'order_by' => 'created_on',
+ 'order_by' => 'created_at',
'sort' => 'desc',
'show_past' => 'no',
- 'date_by' => 'created_on',
+ 'date_by' => 'created_at',
'limit' => $this->attribute('limit', null),
'offset' => $this->attribute('offset')
);
@@ -253,7 +253,7 @@ public function posts()
$post['keywords_arr'] = $keywords_arr;
// Full URL for convenience.
- $post['url'] = site_url('blog/'.date('Y/m', $post['created_on']).'/'.$post['slug']);
+ $post['url'] = site_url('blog/'.date('Y/m', $post['created_at']).'/'.$post['slug']);
// What is the preview? If there is a field called intro,
// we will use that, otherwise we will cut down the blog post itself.
6 system/cms/modules/blog/views/admin/form.php
View
@@ -99,9 +99,9 @@
<label><?php echo lang('blog:date_label') ?></label>
<div class="input datetime_input">
- <?php echo form_input('created_on', date('Y-m-d', $post->created_at), 'maxlength="10" id="datepicker" class="text width-20"') ?> &nbsp;
- <?php echo form_dropdown('created_on_hour', $hours, date('H', $post->created_at)) ?> :
- <?php echo form_dropdown('created_on_minute', $minutes, date('i', ltrim($post->created_at, '0'))) ?>
+ <?php echo form_input('created_at', date('Y-m-d', $post->created_at), 'maxlength="10" id="datepicker" class="text width-20"') ?> &nbsp;
+ <?php echo form_dropdown('created_at_hour', $hours, date('H', $post->created_at)) ?> :
+ <?php echo form_dropdown('created_at_minute', $minutes, date('i', ltrim($post->created_at, '0'))) ?>
</div>
</li>
6 system/cms/modules/blog/views/admin/form/tabs/options.php
View
@@ -22,9 +22,9 @@
<li class="date-meta">
<label><?php echo lang('blog:date_label') ?></label>
<div class="input datetime_input">
- <?php echo form_input('created_on', date('Y-m-d', strtotime($post->created_at)), 'maxlength="10" id="datepicker" class="text width-20"') ?> &nbsp;
- <?php echo form_dropdown('created_on_hour', $hours, date('H', strtotime($post->created_at))) ?> :
- <?php echo form_dropdown('created_on_minute', $minutes, date('i', ltrim(strtotime($post->created_at), '0'))) ?>
+ <?php echo form_input('created_at', date('Y-m-d', strtotime($post->created_at)), 'maxlength="10" id="datepicker" class="text width-20"') ?> &nbsp;
+ <?php echo form_dropdown('created_at_hour', $hours, date('H', strtotime($post->created_at))) ?> :
+ <?php echo form_dropdown('created_at_minute', $minutes, date('i', ltrim(strtotime($post->created_at), '0'))) ?>
</div>
</li>
2  system/cms/modules/blog/views/archive.php
View
@@ -13,7 +13,7 @@
<div class="date">
{{ helper:lang line="blog:posted_label" }}
- <span>{{ helper:date timestamp=created_on }}</span>
+ <span>{{ helper:date timestamp=created_at }}</span>
</div>
{{ if category }}
2  system/cms/modules/blog/views/posts.php
View
@@ -10,7 +10,7 @@
<div class="date">
{{ helper:lang line="blog:posted_label" }}
- <span>{{ helper:date timestamp=created_on }}</span>
+ <span>{{ helper:date timestamp=created_at }}</span>
</div>
{{ if category }}
2  system/cms/modules/blog/views/view.php
View
@@ -10,7 +10,7 @@
<div class="date">
{{ helper:lang line="blog:posted_label" }}
- <span>{{ helper:date timestamp=created_on }}</span>
+ <span>{{ helper:date timestamp=created_at }}</span>
</div>
<div class="author">
2  system/cms/modules/comments/controllers/admin.php
View
@@ -86,7 +86,7 @@ public function index()
// Add "limit" and "offset"
$filter += $pagination;
- $filter['order-by'] = 'created_on';
+ $filter['order-by'] = 'created_at';
$filter['order-dir'] = 'desc';
$comments = Comment::findWithFilter($filter);
1  system/cms/modules/comments/controllers/comments.php
View
@@ -80,7 +80,6 @@ public function create($module = null)
'comment' => $this->input->post('comment'),
'is_active' => (bool) (($this->current_user and $this->current_user->isSuperUser()) or ! Settings::get('moderate_comments')),
'ip_address' => $this->input->ip_address(),
- 'created_on' => time(),
);
// Logged in? in which case, we already know their name and email
2  system/cms/modules/comments/details.php
View
@@ -95,7 +95,7 @@ public function install($pdb, $schema)
$table->string('entry_plural', 100);
$table->string('uri', 255)->nullable();
$table->string('cp_uri', 255)->nullable();
- $table->integer('created_on')->nullable();
+ $table->dateTime('created_at');
$table->integer('ip_address')->nullable();
});
6 system/cms/modules/comments/src/Pyro/Module/Comments/Model/Comment.php
View
@@ -36,7 +36,7 @@ class Comment extends Eloquent
*
* @var boolean
*/
- public $timestamps = false;
+ public $timestamps = true;
/**
* Returns the relationship between comments and users
@@ -64,7 +64,7 @@ public static function findByEntry($module, $entry_key, $entry_id, $is_active =
->where('entry_id', $entry_id)
->where('entry_key', $entry_key)
->where('is_active', $is_active)
- ->orderBy('created_on', Settings::get('comment_order'))
+ ->orderBy('created_at', Settings::get('comment_order'))
->get();
}
@@ -81,7 +81,7 @@ public static function findRecent($limit = 10, $is_active = true)
return static::with('user', 'user.profile')
->where('is_active', $is_active)
->take($limit)
- ->orderBy('created_on', 'desc')
+ ->orderBy('created_at', 'desc')
->get();
}
2  system/cms/modules/comments/views/admin/preview.php
View
@@ -1,7 +1,7 @@
<div id="comment-preview">
<p class="width-two-thirds float-left spacer-bottom-half">
- <strong><?php echo lang('comments:posted_label') ?>:</strong> <?php echo format_date($comment->created_on)?><br/>
+ <strong><?php echo lang('comments:posted_label') ?>:</strong> <?php echo format_date($comment->created_at) ?><br/>
<strong><?php echo lang('comments:from_label') ?>:</strong> <?php echo $comment->user_name ?>
</p>
2  system/cms/modules/comments/views/admin/tables/comments.php
View
@@ -49,7 +49,7 @@
</td>
- <td><?php echo format_date($comment->created_on) ?></td>
+ <td><?php echo format_date($comment->created_at) ?></td>
<td class="align-center buttons buttons-small">
<?php if (Settings::get('moderate_comments')): ?>
2  system/cms/modules/comments/views/display.php
View
@@ -15,7 +15,7 @@
<?php endif ?>
</div>
<div class="date">
- <p><?php echo format_date($item->created_on) ?></p>
+ <p><?php echo format_date($item->created_at) ?></p>
</div>
<div class="content">
<?php if (Settings::get('comment_markdown') and $item->parsed): ?>
36 system/cms/modules/pages/controllers/admin.php
View
@@ -385,7 +385,6 @@ public function create()
$page->rss_enabled = ! empty($input['rss_enabled']);
$page->comments_enabled = ! empty($input['comments_enabled']);
$page->status = $input['status'];
- $page->created_on = time();
$page->restricted_to = isset($input['restricted_to']) ? implode(',', $input['restricted_to']) : 0;
$page->strict_uri = ! empty($input['strict_uri']);
$page->is_home = ! empty($input['is_home']);
@@ -554,11 +553,12 @@ public function edit($id = 0)
$page->rss_enabled = ! empty($input['rss_enabled']);
$page->comments_enabled = ! empty($input['comments_enabled']);
$page->status = $input['status'];
- $page->updated_on = time();
$page->restricted_to = isset($input['restricted_to']) ? implode(',', $input['restricted_to']) : '0';
$page->strict_uri = ! empty($input['strict_uri']);
- if (isset($page->is_home)) unset($page->is_home);
+ if (isset($page->is_home)) {
+ unset($page->is_home);
+ }
$stream = $page->type->stream;
@@ -567,8 +567,7 @@ public function edit($id = 0)
$this->validator->setModel(new $entryModelClass);
// validate and insert
- if ($this->validator->validate($input) and $enableSave = $page->save())
- {
+ if ($this->validator->validate($input) and $enableSave = $page->save()) {
$page->buildLookup();
Events::trigger('page_updated', $page);
@@ -577,9 +576,7 @@ public function edit($id = 0)
//@TODO Fix Me Bro https://github.com/pyrocms/pyrocms/pull/2514
// $this->cache->forget('navigation_m');
}
- }
- else
- {
+ } else {
// Save the entry type if it was not set
$page->setEntryType()->save();
}
@@ -601,14 +598,12 @@ public function edit($id = 0)
$ui = new EntryUi;
- if ($page->entry)
- {
+ if ($page->entry) {
// We can pass the page model to generate the form
$ui = $ui->form($page->entry);
- }
+
// If for some reason the page does not have an entry, lets give it a chance to get a new one
- else
- {
+ } else {
$ui = $ui->form($stream->stream_slug, $stream->stream_namespace)
->onSaved(function($entry) use ($page)
{
@@ -716,7 +711,7 @@ private function _tabs()
),
);
- return $tabs;
+ return $tabs;
}
/**
@@ -733,12 +728,12 @@ public function delete($id = 0)
$ids = ($id) ? array($id) : $this->input->post('action_to');
// Go through the array of slugs to delete
- if ( ! empty($ids)) {
+ if (! empty($ids)) {
foreach ($ids as $id) {
if ($id !== 1) {
- if ( ! $page = Page::find($id)) {
+ if (! $page = Page::find($id)) {
continue;
}
@@ -747,7 +742,9 @@ public function delete($id = 0)
$deleted_ids = $id;
// Delete any page comments for this entry
- $comments = Comment::where('module','=','pages')->where('entry_id','=',$id)->delete();
+ Comment::where('module', '=', 'pages')
+ ->where('entry_id', '=', $id)
+ ->delete();
// Wipe cache for this model, the content has changd
$this->cache->forget('page_m');
@@ -760,11 +757,11 @@ public function delete($id = 0)
}
// Some pages have been deleted
- if ( ! empty($deleted_ids)) {
+ if (! empty($deleted_ids)) {
Events::trigger('page_deleted', $deleted_ids);
// Only deleting one page
- if ( count($deleted_ids) == 1 ) {
+ if (count($deleted_ids) === 1) {
$this->session->set_flashdata('success', sprintf(lang('pages:delete_success'), $deleted_ids[0]));
// Deleting multiple pages
@@ -780,5 +777,4 @@ public function delete($id = 0)
redirect('admin/pages');
}
-
}
4 system/cms/modules/pages/controllers/pages.php
View
@@ -1,5 +1,6 @@
<?php
+use Carbon\Carbon;
use Pyro\Module\Pages\Model\Page;
use Pyro\Module\Keywords\Model\Applied as AppliedKeywords;
@@ -316,7 +317,6 @@ public function _rss($url_segments)
foreach ($children as &$row) {
$row->link = $row->uri ?: $row->slug;
- $row->created_on = date(DATE_RSS, $row->created_on);
$data['rss']['items'][] = array(
//'author' => $row->author,
@@ -324,7 +324,7 @@ public function _rss($url_segments)
'link' => $row->link,
'guid' => $row->link,
'description' => $row->meta_description,
- 'date' => $row->created_on
+ 'date' => Carbon::parse($row->created_at)->toRSSString(),
);
}
}
68 system/cms/modules/pages/controllers/sitemap.php
View
@@ -1,46 +1,48 @@
<?php
+use Carbon\Carbon;
use Pyro\Module\Pages\Model\Page;
-
use Sitemap\Collection as SitemapCollection;
use Sitemap\Sitemap\SitemapEntry;
use Sitemap\Formatter\XML\URLSet;
/**
*
- * @author PyroCMS Dev Team
- * @package PyroCMS\Core\Modules\Pages\Controllers
+ * @author PyroCMS Dev Team
+ * @package PyroCMS\Core\Modules\Pages\Controllers
*/
class Sitemap extends Public_Controller
{
- /**
- * XML
- *
- * @return void
- */
- public function xml()
- {
- // Get all pages
- $pages = Page::findStatus('live');
-
- $collection = new SitemapCollection;
- $collection->setFormatter(new URLSet);
-
- foreach ($pages as $page) {
- // Skip the 404 page!
- if (in_array($page->uri, array('404'))) {
- continue;
- }
-
- $entry = new SitemapEntry;
- $entry->setLocation(site_url($page->is_home ? '' : $page->uri));
- $entry->setLastMod(date(DATE_W3C, $page->updated_on ?: $page->created_on));
-
- $collection->addSitemap($entry);
- }
-
- $this->output
- ->set_content_type('application/xml')
- ->set_output($collection->output());
- }
+ /**
+ * XML
+ *
+ * @return void
+ */
+ public function xml()
+ {
+ // Get all pages
+ $pages = Page::findStatus('live');
+
+ $collection = new SitemapCollection;
+ $collection->setFormatter(new URLSet);
+
+ foreach ($pages as $page) {
+ // Skip the 404 page!
+ if (in_array($page->uri, array('404'))) {
+ continue;
+ }
+
+ $entry = new SitemapEntry;
+ $entry->setLocation(site_url($page->is_home ? '' : $page->uri));
+
+ $lastMod = $page->updated_at ?: $page->created_at;
+ $entry->setLastMod(Carbon::parse($lastMod)->toW3CString());
+
+ $collection->addSitemap($entry);
+ }
+
+ $this->output
+ ->set_content_type('application/xml')
+ ->set_output($collection->output());
+ }
}
19 system/cms/modules/pages/details.php
View
@@ -160,10 +160,11 @@ public function install($pdb, $schema)
$table->text('css')->nullable();
$table->text('js')->nullable();
$table->string('theme_layout', 100)->default('default');
- $table->integer('updated_on');
$table->string('save_as_files', 1)->default('n');
$table->string('content_label', 60)->nullable();
$table->string('title_label', 100)->nullable();
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
});
// Pages Schema ----
@@ -198,8 +199,8 @@ public function install($pdb, $schema)
$table->boolean('is_home')->default(false);
$table->boolean('strict_uri')->default(true);
$table->integer('order')->default(0);
- $table->integer('created_on');
- $table->integer('updated_on')->nullable();
+ $table->dateTime('created_at');
+ $table->dateTime('updated_at')->nullable();
$table->index('slug');
$table->index('parent_id');
@@ -233,7 +234,7 @@ public function install($pdb, $schema)
'body' => '<h2>{{ page:title }}</h2>'."\n\n".'{{ body }}',
'css' => '',
'js' => '',
- 'updated_on' => time()
+ 'created_at' => date('Y-m-d H:i:s'),
));
$pageEntryModel = $stream->getEntryModelClass('def_page_fields', 'pages');
@@ -249,8 +250,8 @@ public function install($pdb, $schema)
'entry_type' => $pageEntryModel,
'status' => 'live',
'restricted_to' => '',
- 'created_on' => time(),
- 'is_home' => 1,
+ 'created_at' => date('Y-m-d H:i:s'),
+ 'is_home' => true,
'order' => time()
),
'contact' => array(
@@ -262,8 +263,8 @@ public function install($pdb, $schema)
'entry_type' => $pageEntryModel,
'status' => 'live',
'restricted_to' => '',
- 'created_on' => time(),
- 'is_home' => 0,
+ 'created_at' => date('Y-m-d H:i:s'),
+ 'is_home' => false,
'order' => time()
),
'fourohfour' => array(
@@ -275,7 +276,7 @@ public function install($pdb, $schema)
'entry_type' => $pageEntryModel,
'status' => 'live',
'restricted_to' => '',
- 'created_on' => time(),
+ 'created_at' => date('Y-m-d H:i:s'),
'is_home' => 0,
'order' => time()
)
8 system/cms/modules/pages/plugin.php
View
@@ -59,7 +59,7 @@ public function _self_doc()
),
'single' => true,
'double' => true,
- 'variables' => 'title|slug|uri|parent_id|type_id|entry_id|css|js|meta_title|meta_keywords|meta_description|rss_enabled|comments_enabled|status|created_on|updated_on|restricted_to|is_home|strict_uri|page_type_slug|page_type_title|custom_fields }}{{ field }}{{ /custom_fields',
+ 'variables' => 'title|slug|uri|parent_id|type_id|entry_id|css|js|meta_title|meta_keywords|meta_description|rss_enabled|comments_enabled|status|created_at|updated_at|restricted_to|is_home|strict_uri|page_type_slug|page_type_title|custom_fields }}{{ field }}{{ /custom_fields',
'attributes' => array(
'id' => array(
'type' => 'number',
@@ -81,7 +81,7 @@ public function _self_doc()
),
'single' => false,
'double' => true,
- 'variables' => 'title|slug|uri|parent_id|type_id|entry_id|css|js|meta_title|meta_keywords|meta_description|rss_enabled|comments_enabled|status|created_on|updated_on|restricted_to|is_home|strict_uri|page_type_slug|page_type_title|custom_fields }}{{ field }}{{ /custom_fields',
+ 'variables' => 'title|slug|uri|parent_id|type_id|entry_id|css|js|meta_title|meta_keywords|meta_description|rss_enabled|comments_enabled|status|created_at|updated_at|restricted_to|is_home|strict_uri|page_type_slug|page_type_title|custom_fields }}{{ field }}{{ /custom_fields',
'attributes' => array(
'id' => array(
'type' => 'number',
@@ -97,7 +97,7 @@ public function _self_doc()
),
'order-by' => array(
'type' => 'flag',
- 'flags' => 'title|slug|uri|parent_id|status|created_on|updated_on|order|page_type_slug|page_type_title',
+ 'flags' => 'title|slug|uri|parent_id|status|created_at|updated_at|order|page_type_slug|page_type_title',
'default' => 'order',
'required' => false,
),
@@ -155,7 +155,7 @@ public function _self_doc()
),
'order-by' => array(
'type' => 'flag',
- 'flags' => 'title|slug|uri|parent_id|status|created_on|updated_on|order|page_type_slug|page_type_title',
+ 'flags' => 'title|slug|uri|parent_id|status|created_at|updated_at|order|page_type_slug|page_type_title',
'default' => 'order',
'required' => false,
),
6 system/cms/modules/search/details.php
View
@@ -51,8 +51,8 @@ public function install($pdb, $schema)
$table->increments('id');
$table->string('title', 255)->fulltext();
$table->text('description')->fulltext();
- $table->text('keywords')->fulltext();
- $table->text('keywords_hash');
+ $table->text('keywords')->fulltext()->nullable();
+ $table->text('keywords_hash')->nullable();
$table->string('module', 40);
$table->string('scope', 100);
$table->string('entry_singular', 100);
@@ -93,7 +93,7 @@ public function install($pdb, $schema)
$cp_uri = 'admin/pages/edit/'.$page->id,
$group_access = null,
$user_access = null
- );
+ );
}
}
2  system/cms/modules/search/src/Pyro/Module/Search/Model/Search.php
View
@@ -58,7 +58,7 @@ class Search extends Eloquent
* $post->title,
* $post->intro,
* 'keywords' => $post->keywords,
- * 'blog/'.date('Y/m/', $post->created_on).$post->slug,
+ * 'blog/'.date('Y/m/', $post->created_at).$post->slug,
* 'cp_edit_uri' => 'admin/blog/edit/'.$id,
* 'cp_delete_uri' => 'admin/blog/delete/'.$id,
* 'group_access' => json_encode($ids),
303 system/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/BlogsBlogEntryModel.php
View
@@ -0,0 +1,303 @@
+<?php namespace Pyro\Module\Streams\Model;
+
+use Pyro\Module\Streams\Entry\EntryModel;
+
+class BlogsBlogEntryModel extends EntryModel
+{
+ /**
+ * The table
+ * @type string
+ */
+ protected $table = 'blog';
+
+ /**
+ * The compiled stream data as an array
+ */
+ protected static $streamData = array(
+ 'id' => 1,
+ 'stream_name' => 'lang:blog:blog_title',
+ 'stream_slug' => 'blog',
+ 'stream_namespace' => 'blogs',
+ 'stream_prefix' => null,
+ 'about' => null,
+ 'view_options' => array(
+ 'id',
+ 'created_at',
+ ),
+ 'title_column' => null,
+ 'sorting' => 'title',
+ 'permissions' => 'N;',
+ 'hidden' => 'no',
+ 'menu_path' => null,
+ 'assignments' => array(
+ array(
+ 'id' => 1,
+ 'sort_order' => 1,
+ 'stream_id' => 1,
+ 'field_id' => 1,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.title.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 1,
+ 'field_name' => 'lang:blog:title_label',
+ 'field_slug' => 'title',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'text',
+ 'field_data' => null,
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:52',
+ 'updated_at' => '2014-02-24 15:53:52',
+ ),
+ ),
+ array(
+ 'id' => 2,
+ 'sort_order' => 2,
+ 'stream_id' => 1,
+ 'field_id' => 2,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.intro.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 2,
+ 'field_name' => 'lang:blog:intro_label',
+ 'field_slug' => 'intro',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'wysiwyg',
+ 'field_data' => array(
+ 'editor_type' => 'simple',
+ 'allow_tags' => 'y',
+ ),
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:52',
+ 'updated_at' => '2014-02-24 15:53:52',
+ ),
+ ),
+ array(
+ 'id' => 3,
+ 'sort_order' => 3,
+ 'stream_id' => 1,
+ 'field_id' => 3,
+ 'required' => 'yes',
+ 'unique' => 'yes',
+ 'instructions' => 'blogs.field.slug.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 3,
+ 'field_name' => 'lang:global:slug',
+ 'field_slug' => 'slug',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'slug',
+ 'field_data' => array(
+ 'slug_field' => 'title',
+ ),
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 4,
+ 'sort_order' => 4,
+ 'stream_id' => 1,
+ 'field_id' => 4,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.body.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 4,
+ 'field_name' => 'lang:global:body',
+ 'field_slug' => 'body',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'wysiwyg',
+ 'field_data' => array(
+ 'editor_type' => 'advanced',
+ ),
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 5,
+ 'sort_order' => 5,
+ 'stream_id' => 1,
+ 'field_id' => 5,
+ 'required' => 'no',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.keywords.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 5,
+ 'field_name' => 'lang:streams:keywords.name',
+ 'field_slug' => 'keywords',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'keywords',
+ 'field_data' => null,
+ 'view_options' => null,
+ 'locked' => 'no',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 6,
+ 'sort_order' => 6,
+ 'stream_id' => 1,
+ 'field_id' => 6,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.author.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 6,
+ 'field_name' => 'lang:blog:author_label',
+ 'field_slug' => 'author',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'user',
+ 'field_data' => null,
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 7,
+ 'sort_order' => 7,
+ 'stream_id' => 1,
+ 'field_id' => 7,
+ 'required' => 'no',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.comments_enabled.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 7,
+ 'field_name' => 'lang:blog:comments_enabled',
+ 'field_slug' => 'comments_enabled',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'choice',
+ 'field_data' => array(
+ 'choice_data' => 'no : lang:global:no
+1 day : lang:global:duration:1-day
+1 week : lang:global:duration:1-week
+2 weeks : lang:global:duration:2-weeks
+1 month : lang:global:duration:1-month
+3 months : lang:global:duration:3-months
+always : lang:global:duration:always
+',
+ ),
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 8,
+ 'sort_order' => 8,
+ 'stream_id' => 1,
+ 'field_id' => 8,
+ 'required' => 'no',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.status.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 8,
+ 'field_name' => 'lang:blog:status_label',
+ 'field_slug' => 'status',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'choice',
+ 'field_data' => array(
+ 'choice_data' => 'draft : lang:blog:draft_label
+live : lang:blog:live_label
+',
+ ),
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 9,
+ 'sort_order' => 9,
+ 'stream_id' => 1,
+ 'field_id' => 9,
+ 'required' => 'no',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.preview_hash.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 9,
+ 'field_name' => 'lang:blog:preview_hash',
+ 'field_slug' => 'preview_hash',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'text',
+ 'field_data' => null,
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ array(
+ 'id' => 10,
+ 'sort_order' => 10,
+ 'stream_id' => 1,
+ 'field_id' => 10,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'blogs.field.category.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 10,
+ 'field_name' => 'lang:blog:category_label',
+ 'field_slug' => 'category',
+ 'field_namespace' => 'blogs',
+ 'field_type' => 'relationship',
+ 'field_data' => array(
+ 'title_field' => 'title',
+ 'relation_class' => 'Pyro\\Module\\Blog\\BlogCategoryModel',
+ ),
+ 'view_options' => null,
+ 'locked' => 'yes',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ ),
+ );
+
+ protected static $relationFieldsData = array(
+ 'author' => array(
+ 'method' => 'belongsTo',
+ 'related' => 'Pyro\Module\Users\Model\User',
+ 'foreignKey' => 'author',
+ ),
+ 'category' => array(
+ 'method' => 'belongsTo',
+ 'related' => 'Pyro\Module\Blog\BlogCategoryModel',
+ 'foreignKey' => 'category',
+ ),
+ );
+
+
+ public function author()
+ {
+ return $this->belongsTo('Pyro\Module\Users\Model\User');
+ }
+
+ public function category()
+ {
+ return $this->belongsTo('Pyro\Module\Blog\BlogCategoryModel');
+ }
+
+}
65 ...m/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/PagesDefPageFieldsEntryModel.php
View
@@ -0,0 +1,65 @@
+<?php namespace Pyro\Module\Streams\Model;
+
+use Pyro\Module\Streams\Entry\EntryModel;
+
+class PagesDefPageFieldsEntryModel extends EntryModel
+{
+ /**
+ * The table
+ * @type string
+ */
+ protected $table = 'def_page_fields';
+
+ /**
+ * The compiled stream data as an array
+ */
+ protected static $streamData = array(
+ 'id' => 2,
+ 'stream_name' => 'Default',
+ 'stream_slug' => 'def_page_fields',
+ 'stream_namespace' => 'pages',
+ 'stream_prefix' => null,
+ 'about' => 'A basic page type to get you started adding content.',
+ 'view_options' => array(
+ 'id',
+ 'created_at',
+ ),
+ 'title_column' => null,
+ 'sorting' => 'title',
+ 'permissions' => 'N;',
+ 'hidden' => 'no',
+ 'menu_path' => null,
+ 'assignments' => array(
+ array(
+ 'id' => 11,
+ 'sort_order' => 1,
+ 'stream_id' => 2,
+ 'field_id' => 11,
+ 'required' => 'no',
+ 'unique' => 'no',
+ 'instructions' => 'pages.field.body.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 11,
+ 'field_name' => 'lang:pages:body_label',
+ 'field_slug' => 'body',
+ 'field_namespace' => 'pages',
+ 'field_type' => 'wysiwyg',
+ 'field_data' => array(
+ 'editor_type' => 'advanced',
+ 'allow_tags' => 'y',
+ ),
+ 'view_options' => null,
+ 'locked' => 'no',
+ 'created_at' => '2014-02-24 15:53:53',
+ 'updated_at' => '2014-02-24 15:53:53',
+ ),
+ ),
+ ),
+ );
+
+ protected static $relationFieldsData = array(
+ );
+
+
+}
395 system/cms/modules/streams_core/models/DefaultSite/Pyro/Module/Streams/Model/UsersProfilesEntryModel.php
View
@@ -0,0 +1,395 @@
+<?php namespace Pyro\Module\Streams\Model;
+
+use Pyro\Module\Streams\Entry\EntryModel;
+
+class UsersProfilesEntryModel extends EntryModel
+{
+ /**
+ * The table
+ * @type string
+ */
+ protected $table = 'profiles';
+
+ /**
+ * The compiled stream data as an array
+ */
+ protected static $streamData = array(
+ 'id' => 3,
+ 'stream_name' => 'lang:user_profile_fields_label',
+ 'stream_slug' => 'profiles',
+ 'stream_namespace' => 'users',
+ 'stream_prefix' => null,
+ 'about' => 'Profiles for users module',
+ 'view_options' => array(
+ 'display_name',
+ ),
+ 'title_column' => 'display_name',
+ 'sorting' => 'title',
+ 'permissions' => 'N;',
+ 'hidden' => 'no',
+ 'menu_path' => null,
+ 'assignments' => array(
+ array(
+ 'id' => 12,
+ 'sort_order' => 1,
+ 'stream_id' => 3,
+ 'field_id' => 12,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'users.field.display_name.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 12,
+ 'field_name' => 'lang:user:display_name',
+ 'field_slug' => 'display_name',
+ 'field_namespace' => 'users',
+ 'field_type' => 'text',
+ 'field_data' => array(
+ 'max_length' => 50,
+ ),
+ 'view_options' => null,
+ 'locked' => 'no',
+ 'created_at' => '2014-02-24 15:53:54',
+ 'updated_at' => '2014-02-24 15:53:54',
+ ),
+ ),
+ array(
+ 'id' => 13,
+ 'sort_order' => 2,
+ 'stream_id' => 3,
+ 'field_id' => 13,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'users.field.first_name.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 13,
+ 'field_name' => 'lang:user:first_name_label',
+ 'field_slug' => 'first_name',
+ 'field_namespace' => 'users',
+ 'field_type' => 'text',
+ 'field_data' => array(
+ 'max_length' => 50,
+ ),
+ 'view_options' => null,
+ 'locked' => 'no',
+ 'created_at' => '2014-02-24 15:53:54',
+ 'updated_at' => '2014-02-24 15:53:54',
+ ),
+ ),
+ array(
+ 'id' => 14,
+ 'sort_order' => 3,
+ 'stream_id' => 3,
+ 'field_id' => 14,
+ 'required' => 'yes',
+ 'unique' => 'no',
+ 'instructions' => 'users.field.last_name.instructions',
+ 'field_name' => null,
+ 'field' => array(
+ 'id' => 14,
+ 'field_name' => 'lang:user:last_name_label',
+ 'field_slug' => 'last_name',
+ 'field_namespace' => 'users',
+ 'field_type' => 'text',
+ 'field_data' => array(
+ 'max_length' => 50,
+ ),
+ 'view_options' => null,