Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 2ec595c65f1c21dcab9a43eb44eeb0b60624fc67
Author: David McReynolds <[email protected]>
Date:   Sat Mar 12 01:30:57 2011 -0800
    removed models and modules
commit e2344482566c82746f342d8ac24ffefd1e605087
Author: David McReynolds <[email protected]>
Date:   Sat Mar 12 01:04:26 2011 -0800
    removed blog captchas
commit 61884bd2431c871b3a78d39182bf0372d27dfd5a
Author: David McReynolds <[email protected]>
Date:   Sat Mar 12 00:55:45 2011 -0800
    removed demo content
commit 5c8d27ca48f20a0bfbfd3aff0aad4bd99f4c78c8
Author: David McReynolds <[email protected]>
Date:   Fri Mar 11 16:57:04 2011 -0800
    fixed captcha issue and added some tests
commit cd73a3c4943e66dee086d3ba72cf27006501c44c
Author: David McReynolds <[email protected]>
Date:   Thu Mar 10 10:34:43 2011 -0800
    fixed spelling error for backup database. Also added ability to extend classes with MY_ from within  application library folder
commit c7686c0b80ca3c413378f4891dcf169a95771812
Author: David McReynolds <[email protected]>
Date:   Thu Mar 10 08:45:53 2011 -0800
    fixed issue with revert to other versions dropdown was not showing up
commit 5320d17f9d202deaa6a229ac999aa4a6fb8f31b8
Author: David McReynolds <[email protected]>
Date:   Wed Mar 9 16:38:04 2011 -0800
    fixes to dates in modules
commit cff2c56fe780dcadaea7020f79c88ec17bead85c
Author: David McReynolds <[email protected]>
Date:   Mon Mar 7 21:39:59 2011 -0800
    fixed issue with rendering collapsible menus with data from the admin
commit 4ae0ec13dbaa0c88814301922a69001c1b4146b3
Author: David McReynolds <[email protected]>
Date:   Mon Mar 7 21:25:36 2011 -0800
    fixed typos in user guide for simple module
commit 5582ff15fb055a9d42352a09f5bfb2411d1d37dd
Author: David McReynolds <[email protected]>
Date:   Mon Mar 7 16:48:48 2011 -0800
    added warning message when you click the rearrange button to give better direction
commit d25c302230dfeea70a737e65ca96a13f7370c6e1
Author: David McReynolds <[email protected]>
Date:   Mon Mar 7 16:31:20 2011 -0800
    added array rendery_type to Menu class
commit 88e6d5281902f07476b5ddb3f807e2aad5afa5d7
Author: David McReynolds <[email protected]>
Date:   Mon Mar 7 14:17:19 2011 -0800
    fixed issue for setting active state for navigation group and added editor settings to MY_fuel.php
commit 62f96a0e891881bc9362a98c00e71f995d6cd6a5
Author: David McReynolds <[email protected]>
Date:   Mon Mar 7 01:02:38 2011 -0800
    added a Fuelpage_test adn fixed an issue in the Menu class
commit 30fd69dc38c23a517070921908aebea9c1f7bb89
Author: David McReynolds <[email protected]>
Date:   Sun Mar 6 21:06:28 2011 -0800
    added all config values from latest CI 2 version. Also began to add a page test for fuel module
commit 1fc59ace1ac706092eea7ce0e6f9fbeea123ce09
Author: David McReynolds <[email protected]>
Date:   Sun Mar 6 17:57:05 2011 -0800
    updated CI 2 core, changed date function names
commit e6aac461a388d565fb9ee703bf1cc5c36bc99dbb
Author: David McReynolds <[email protected]>
Date:   Sat Mar 5 15:01:57 2011 -0800
    made some fixes for uploading blocks and pages on the item page
commit 2d973488a8d59d0238be1ccb1d6525b3d0afc6fe
Author: David McReynolds <[email protected]>
Date:   Sat Mar 5 14:50:30 2011 -0800
    added upload button to item view of pages and blocks
commit 5aee950161c6d919c5702abe0b5ff1b36a1a0c90
Author: David McReynolds <[email protected]>
Date:   Fri Mar 4 16:16:54 2011 -0800
    added triggers for add and remove in jquery.supercomboselect.js
commit 84874614f5ba710dab7b52dcc7192288babdafb1
Author: David McReynolds <[email protected]>
Date:   Fri Mar 4 16:16:36 2011 -0800
    added triggers for add and remove in jquery.supercomboselect.js
commit 3bcdfbcc58363142233a2f5c39cc5b7d37a548d4
Author: David McReynolds <[email protected]>
Date:   Fri Mar 4 09:00:14 2011 -0800
    fixed missing language bit from backup module
commit 48c93d99ce3ccfe9757678a60fcdd55dbada34b0
Author: David McReynolds <[email protected]>
Date:   Thu Mar 3 23:23:07 2011 -0800
    fixed inline editing for ckeditor and linked fields
commit 2f9353f019dbb0cd618c75b330bee334f36d670e
Author: David McReynolds <[email protected]>
Date:   Thu Mar 3 14:51:28 2011 -0800
    added server side processing for linked fields on blur
commit ec81c41cf3122c5235f3df9edb2b2f8747aa44ed
Author: David McReynolds <[email protected]>
Date:   Thu Mar 3 14:00:58 2011 -0800
    just changed MY_Model on_insert hook fix to match 0.9.2
commit bd09860d12643a7a293ae0700ffa62a32b02eeeb
Author: David McReynolds <[email protected]>
Date:   Thu Mar 3 13:55:39 2011 -0800
    added linked field formatters via javascript
commit 0602d1b2f426c8f19dbe7a7f5c66024c27fdd901
Author: David McReynolds <[email protected]>
Date:   Wed Mar 2 22:06:00 2011 -0800
    updates for linked fields and user guide fix
commit b556e1df0c6966c96e68faf3ec14b78a9fbadd60
Author: David McReynolds <[email protected]>
Date:   Mon Feb 28 08:46:18 2011 -0800
    fixed issue regarding saving new pages when using a different language
commit 79e70b7e03ef909e80838ce17d23a2e4a0dec811
Author: David McReynolds <[email protected]>
Date:   Mon Feb 28 08:38:34 2011 -0800
    changed render_table method in Form_builder to pass  array when creating a section
commit c5d72d13cfb47c64e6f303770dc0f85948c41adc
Author: David McReynolds <[email protected]>
Date:   Fri Feb 25 01:13:01 2011 -0800
    fixed toggling between source and ckeditor issues
commit a61dce9631f6ad09e2f01cca5e63a8324c8b7bcb
Author: David McReynolds <[email protected]>
Date:   Thu Feb 24 23:18:47 2011 -0800
    more fixes for view source
commit b1e1d04f14c7493e0587d1ceed3398c07c4b3a96
Author: David McReynolds <[email protected]>
Date:   Thu Feb 24 21:26:17 2011 -0800
    added view source/editor toggle button for ckeditor and markitup
commit d3873df05ecc07bdd17e140cfa7e5be874f4f2df
Author: David McReynolds <[email protected]>
Date:   Thu Feb 24 15:06:58 2011 -0800
    updated jquery and dwoo libraries mostly
commit 6f80251c85b2b3d305b1a973c8356942ca5f97b1
Author: David McReynolds <[email protected]>
Date:   Tue Feb 22 12:25:55 2011 -0800
    uploading of blocks and pages and fix for validate controller
commit e69c810cad349437c383f4531976f4b22fcb46f6
Author: David McReynolds <[email protected]>
Date:   Sun Feb 20 18:14:49 2011 -0800
    added uploading of blocks and pages from list view (like navigation)
commit 6fa5b168f10013aa21e3a41b72fc2bcc5d06d87f
Author: David McReynolds <[email protected]>
Date:   Sun Feb 20 10:15:39 2011 -0800
    fixed some issues with resizing the viewing window and added close button
commit 9c725e34e336865e75ffdf8639e858735a1099f1
Author: David McReynolds <[email protected]>
Date:   Sat Feb 19 17:42:47 2011 -0800
    added ability to view pages within admin
commit 40939e4a261cf1ac30ed4707fcffd4237a56f2b7
Author: David McReynolds <[email protected]>
Date:   Sat Feb 19 17:05:58 2011 -0800
    fixed issue where it will still submit to precedence even if the button was turned off
commit 7f4d7de45c939a09e1064bc78c53aaeb6d4abe00
Author: David McReynolds <[email protected]>
Date:   Sat Feb 19 16:52:06 2011 -0800
    added callback for setting precedence in the list view
commit 92c77849eb4def66cde3a3a02da73e0678ace5b2
Author: David McReynolds <[email protected]>
Date:   Sat Feb 19 12:51:15 2011 -0800
    added basic rearrange (precedence) ability to tables... still need to do callback
commit 1c805cde97483f3bf2ffbb303d18997615a6f8ad
Author: David McReynolds <[email protected]>
Date:   Sat Feb 19 10:25:33 2011 -0800
    fixes for inline editing ckeditor config
commit f778385db90e55329240b203bcef8c4f22b9d1f5
Author: David McReynolds <[email protected]>
Date:   Fri Feb 18 15:05:23 2011 -0800
    fix for inline editing and ckeditor
commit dad0d3d8945607d5b1eadd23e826eb5edde0a737
Author: David McReynolds <[email protected]>
Date:   Fri Feb 18 15:05:05 2011 -0800
    fix to tutorial in user_guide
commit 28357823c4aa303713be1ab3f413fecf60ac0edd
Author: David McReynolds <[email protected]>
Date:   Wed Feb 16 09:26:09 2011 -0800
    changed .htaccess
commit 2b9434d9a8e4d2df1f5ec0953764541a9e1837a7
Author: David McReynolds <[email protected]>
Date:   Wed Feb 16 09:20:30 2011 -0800
    ckeditor changes
commit 924b669da72028906f2b1f3e9b57e615c611540e
Merge: f51acdb 9fc32db
Author: David McReynolds <[email protected]>
Date:   Mon Feb 14 22:00:11 2011 -0800
    Merge branch 'master' into 0.9.3_dev
    Conflicts:
    	fuel/application/views/_layouts/sitemap_xml.php
    	fuel/application/views/sitemap_xml.php
commit f51acdbc323de47982d476e9e11bfd5ec28cae4b
Author: David McReynolds <[email protected]>
Date:   Mon Feb 14 12:13:48 2011 -0800
    removed script tags from preview that can cause issues with markUtUp! Also, fixed Asset class to only call the loading of the config file once
commit 5cce8b824e646edd2b595d46633dfaab828f2ca7
Author: David McReynolds <[email protected]>
Date:   Mon Feb 14 10:02:13 2011 -0800
    added database and htaccess back in
commit 78587761cfc2404bc6b9fa27da267d25e95d6daf
Merge: 5dd38b2 53cc1a9
Author: David McReynolds <[email protected]>
Date:   Mon Feb 14 09:59:07 2011 -0800
    Merge branch 'master' into 0.9.3_dev
commit 5dd38b2fd6cc85b70427209ef82e26520bcee1cf
Author: David McReynolds <[email protected]>
Date:   Mon Feb 14 08:06:33 2011 -0800
    made change to Form prep method
commit 99e3a1148aab3d11b20fffec18731bf6ed5ef983
Author: David McReynolds <[email protected]>
Date:   Mon Feb 14 07:43:36 2011 -0800
    first changes for ckeditor
commit 7ec412a8cf0249770787ed233feff8e091e99e07
Author: David McReynolds <[email protected]>
Date:   Sun Feb 13 16:41:39 2011 -0800
    added .gitignore to exclude certain files
commit d989929a1a98dc8b0f00ef68ad6409e0c44132e2
Author: David McReynolds <[email protected]>
Date:   Sun Feb 13 12:00:06 2011 -0800
    removed .htaccess and database from being tracked
commit 959fe3b5cd6f0c6f8f0c7104bc1813a0dfd6b0ee
Author: David McReynolds <[email protected]>
Date:   Sun Feb 13 11:55:28 2011 -0800
    added back demo files after merge from master
  • Loading branch information
David McReynolds committed Mar 14, 2011
1 parent 1b75a27 commit 953f456
Show file tree
Hide file tree
Showing 828 changed files with 118,178 additions and 1,166 deletions.
2 changes: 1 addition & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RewriteBase /
RewriteRule ^(fuel/modules/(.+)?/assets/(.+)) - [L]

# Protect application and system files from being viewed
RewriteRule ^(fuel/install/.+|fuel/crons/.+|fuel/data_backup/.+|fuel/codeigniter/.+|fuel/modules/.+|fuel/application/.+) - [F,L]
RewriteRule ^(fuel/install/.+|fuel/crons/.+|fuel/data_backup/.+|fuel/codeigniter/.+|fuel/modules/.+|fuel/application/.+|\.git.+) - [F,L]


RewriteCond %{REQUEST_FILENAME} !-f
Expand Down
Empty file modified assets/css/blog.css
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions assets/css/common.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/***************************************************************
GENERIC CLASSES
***************************************************************/
.clear { clear: both; height: 0; line-height: 0; font-size: 0; }
.hidden { display: none; }
.float_left { float: left; }
.float_right { float: right; }
.txt_hidden { text-indent: -1000px; overflow: hidden; }

/* for form */
div.error, li.error, ul.error { background-color: #c30; color: #fff; padding: 2px 5px; }
span.error_highlight input, span.error_highlight textarea, span.error_highlight select { border: 2px solid #c30; }

/* for ckeditor */
.ckeditor { background-color: #fff; padding: 5px; color: #000; font-size: 12px; }
23 changes: 9 additions & 14 deletions assets/css/main.css
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
RESET BROWSER VALUES SO EVERYONE IS THE SAME
***************************************************************/
@import url(reset.css);
@import url(common.css);


/***************************************************************
Expand All @@ -28,22 +29,16 @@ GENERIC CLASSES
***************************************************************/
.left { float: left; }
.right { float: right; }
.clear { clear: both; height: 0; line-height: 0; font-size: 0; }
.txt_hidden { text-indent: -1000px; overflow: hidden; }
.block { margin-bottom: 30px; }
a.readmore { display: block; }
table.form td { padding: 3px 5px 3px 0; }

/* for form */
.error { background-color: #c30; color: #fff; padding: 2px 5px; }
span.error_highlight input, span.error_highlight textarea, span.error_highlight select { border: 2px solid #c30; }


/***************************************************************
SPECIFIC AREAS
***************************************************************/

div#container { background: #000 url(../images/bg_waves.jpg) no-repeat top center; }
div#error_404 { margin: -100px 0 0 340px; }
div#container { background: #000 url(http://www.getfuelcms.com/assets/images/bg_waves.jpg) no-repeat top center; }
div#container_inner { position: relative; width: 960px; margin: auto; }
div#header { width: 840px; height: 370px; margin: auto; position: relative; }

Expand All @@ -55,12 +50,12 @@ div#topnav li a { display: block; margin: 0 10px; line-height: 12px; text-decora
div#topnav li.last { border: none; }

/* logo */
a#daylight_logo { position: absolute; top: 20px; left: 0px; background: transparent url(../images/logo_daylight.png) no-repeat center center; width: 166px; height: 30px; display: block; }
a#fuel_logo { display: block; text-indent: -10000px; overflow: hidden; position: absolute; top: 60px; left: 0px; background: transparent url(../images/logo_fuel.png) no-repeat center center; height: 340px; width: 340px; }
a#daylight_logo { position: absolute; top: 20px; left: 0px; background: transparent urlhttp://www.getfuelcms.com/assets/images/logo_daylight.png) no-repeat center center; width: 166px; height: 30px; display: block; }
a#fuel_logo { display: block; text-indent: -10000px; overflow: hidden; position: absolute; top: 60px; left: 0px; background: transparent url(http://www.getfuelcms.com/assets/images/logo_fuel.png) no-repeat center center; height: 340px; width: 340px; }

div#fuel_intro { padding-top: 120px; margin-left: 360px; position: relative; }
div#fuel_intro h1#fuel_cms { background: transparent url(../images/fuel_cms.png) no-repeat center center; width: 247px; height: 53px; text-indent: -10000px; overflow: hidden; margin-bottom: 10px;}
div#fuel_intro div#fuel_tagline { background: transparent url(../images/hdr_tagline.png) no-repeat center center; width: 338px; height: 46px; margin-bottom: 5px; }
div#fuel_intro h1#fuel_cms { background: transparent url(http://www.getfuelcms.com/assets/images/fuel_cms.png) no-repeat center center; width: 247px; height: 53px; text-indent: -10000px; overflow: hidden; margin-bottom: 10px;}
div#fuel_intro div#fuel_tagline { background: transparent url(http://www.getfuelcms.com/assets/images/hdr_tagline.png) no-repeat center center; width: 338px; height: 46px; margin-bottom: 5px; }
div#fuel_intro div#fuel_text { font-size: 13px; margin-left: 30px; position: relative; }
div#fuel_intro div#fuel_text p { margin-bottom: 10px; }

Expand All @@ -75,12 +70,12 @@ div#for_clients { width: 342px; float: left; padding-right: 20px; }
div#for_developers { width: 342px; float: left; padding-left: 20px;}

/* footer */
div#footer { color: #fff; background: transparent url(../images/footer_bg.jpg) repeat-x; height: 117px; }
div#footer { color: #fff; background: transparent url(http://www.getfuelcms.com/assets/images/footer_bg.jpg) repeat-x; height: 117px; }
div#footer p, div#footer li, div#footer address { font-size: 11px; }
div#footer p, div#footer address { line-height: 11px; }
div#footer h4 { margin-bottom: 5px; }
div#footer a { color: #fff; }
div#footer_top { padding: 20px 50px 20px 50px; background: #ef9742 url(../images/footer_bg.jpg) repeat-x; height: 110px; }
div#footer_top { padding: 20px 50px 20px 50px; background: #ef9742 url(http://www.getfuelcms.com/assets/images/footer_bg.jpg) repeat-x; height: 110px; }
div#footer_top div#footer_follow { width: 120px; }
div#footer_bot { padding: 10px 50px; background-color: #dc481d; height: 30px; }
div#request_demo_container { position: absolute; right: 85px; top: 30px; }
Expand Down
Empty file modified assets/css/reset.css
100644 → 100755
Empty file.
Binary file removed assets/images/bg_waves.jpg
Binary file not shown.
Binary file removed assets/images/footer_bg.jpg
Binary file not shown.
Binary file removed assets/images/fuel_cms.png
Binary file not shown.
Binary file removed assets/images/hdr_tagline.png
Binary file not shown.
Binary file removed assets/images/logo_daylight.png
Binary file not shown.
Binary file removed assets/images/logo_fuel.png
Binary file not shown.
6 changes: 3 additions & 3 deletions assets/js/jquery.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions fuel/application/config/MY_fuel.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,29 @@
'swf',
);

// text editor settings... options are markitup or ckeditor
$config['text_editor'] = 'markitup';

// ck editor specific settings
$config['ck_editor_settings'] = array(
'toolbar' => array(
//array('Source'),
array('Bold','Italic','Strike'),
array('Format'),
array('Image','HorizontalRule'),
array('NumberedList','BulletedList'),
array('Link','Unlink'),
array('Undo','Redo','RemoveFormat'),
array('Preview'),
array('Maximize'),
),
'contentsCss' => WEB_PATH.'assets/css/main.css',
'htmlEncodeOutput' => FALSE,
'entities' => FALSE,
'bodyClass' => 'ckeditor',
'toolbarCanCollapse' => FALSE,
);


/* End of file MY_fuel.php */
/* Location: ./application/config/MY_fuel.php */
Empty file modified fuel/application/config/database.php
100644 → 100755
Empty file.
Empty file modified fuel/application/config/doctypes.php
100755 → 100644
Empty file.
Empty file modified fuel/application/config/foreign_chars.php
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion fuel/application/config/mimes.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3'),
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
Expand Down
Empty file modified fuel/application/config/profiler.php
100755 → 100644
Empty file.
1 change: 0 additions & 1 deletion fuel/application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
$route['default_controller'] = 'fuel/page_router';
$route['404_override'] = 'fuel/page_router';


/*
| Uncomment this line if you want to use the automatically generated sitemap based on your navigation.
| To modify the sitemap.xml, go to the views/sitemap_xml.php file.
Expand Down
Empty file modified fuel/application/config/smileys.php
100755 → 100644
Empty file.
Empty file modified fuel/application/config/user_agents.php
100755 → 100644
Empty file.
102 changes: 102 additions & 0 deletions fuel/application/controllers/contact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
class Contact extends CI_Controller {

function __construct()
{
parent::__construct();
}

function index()
{
$this->load->library('session');
$this->load->library('form_builder');

if (!empty($_POST) AND $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR'])
{
// put your processing code here... we show what we do for emailing. You will need to add a correct email address
if ($this->_process($_POST))
{
$this->session->set_flashdata('success', TRUE);
redirect('contact');
}
}

$fields = array();
$fields['first_name'] = array('required' => TRUE);
$fields['last_name'] = array('required' => TRUE);
$fields['email'] = array('required' => TRUE);
$fields['question'] = array('required' => TRUE, 'type' => 'textarea');

$this->form_builder->set_fields($fields);

// will set the values of the fields if there is an error... must be after set_fields
$this->form_builder->set_validator($this->validator);
$this->form_builder->set_field_values($_POST);
$this->form_builder->display_errors = TRUE;
$this->form_builder->required_text = '<span class="required">*</span>required fields';
$vars['form'] = $this->form_builder->render();

// use Fuel_page to render so it will grab all opt-in variables and do any necessary parsing
$page_init = array('location' => 'contact');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->add_variables($vars);
$this->fuel_page->render();
}

function _process($data)
{
$this->load->library('validator');
/*
Set rules up here so we can pass them to the form_builder to display errors.
validator_helper contains the valid_email function... validator helper automatically gets' looded with Validation Class'
*/


$this->validator->add_rule('first_name', 'required', 'Please enter in an first name', $this->input->post('first_name'));
$this->validator->add_rule('last_name', 'required', 'Please enter in an last name', $this->input->post('last_name'));
$this->validator->add_rule('email', 'valid_email', 'Please enter in a valid email', $this->input->post('email'));
$this->validator->add_rule('question', 'required', 'Please enter in an question', $this->input->post('question'));


if ($this->validator->validate())
{
$this->load->library('email');
$this->load->helper('inflector');

// send email
$this->email->from($data['email'], $data['first_name'] . ' ' . $data['last_name']);

/*********************************************************************
YOU MUST FILL OUT THE CORRECT dev_email config in application/config/MY_config.php
AND/OR THE CORRECT TO email address
*********************************************************************/
// check config if we are in dev mode
if ($this->config->item('dev_mode'))
{
$this->email->to($this->config->item('dev_email'));
}
else
{
// need to fill this out to work
$this->email->to('');
}
$this->email->subject('Website Contact Form');
$msg = "The following information was submitted:\n";
foreach($data as $key => $val)
{
$msg .= humanize($key, 3).": ".$val."\n";
}
$this->email->message($msg);

// let her rip
if (!$this->email->send())
{
add_error('There was an error notifying');
return FALSE;
}

return TRUE;
}

}
}
53 changes: 50 additions & 3 deletions fuel/application/core/MY_Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class MY_Model extends CI_Model {
public $readonly = FALSE; // sets the model to readonly mode where you can't save or delete data'
public $hidden_fields = array(); // fields to hide when creating a form
public $unique_fields = array(); // fields that are not IDs but are unique
public $linked_fields = array(); // fields that are are linked. Key is the field, value is a function name to transform it
public $foreign_keys = array(); // map foreign keys to table models

protected $db; // CI database object
Expand Down Expand Up @@ -729,10 +730,13 @@ public function clean($values = array())
{
if (isset($values[$key]))
{
$clean[$key] = ($this->auto_trim) ? trim($values[$key]) : $values[$key];
$values[$key] = ($this->auto_trim) ? trim($values[$key]) : $values[$key];
}
}

// process linked fields
$values = $this->process_linked($values);

foreach ($fields as $key => $field)
{

Expand All @@ -742,13 +746,13 @@ public function clean($values = array())
if (isset($values[$key.'_hour']))
{
if (empty($values[$key]) OR (int)$values[$key] == 0) $values[$key] = $this->default_date;
$values[$key] = english_to_db_format($values[$key], @$values[$key.'_hour'], @$values[$key.'_min'], @$values[$key.'_sec'], @$values[$key.'_am_pm']);
$values[$key] = english_date_to_db_format($values[$key], @$values[$key.'_hour'], @$values[$key.'_min'], @$values[$key.'_sec'], @$values[$key.'_am_pm']);
}
}
else if ($field['type'] == 'date')
{
if (empty($values[$key]) OR (int)$values[$key] == 0) $values[$key] = $this->default_date;
if (isset($values[$key]) AND !is_db_format($values[$key])) $values[$key] = english_to_db_format($values[$key]);
if (isset($values[$key]) AND !is_date_db_format($values[$key])) $values[$key] = english_date_to_db_format($values[$key]);
}

$date_func = ($this->date_use_gmt) ? 'gmdate' : 'date';
Expand Down Expand Up @@ -1871,7 +1875,50 @@ public function normalize_save_values($record)
return $values;
}

// --------------------------------------------------------------------

/**
* Process linked fields
*
* @access public
* @param array values to be saved
* @return array
*/
public function process_linked($values)
{

// process linked fields
foreach($this->linked_fields as $field => $func_val)
{
if (empty($values[$field]))
{
if (is_string($func_val) AND !empty($values[$func_val]))
{
// convenience for most common
$values[$field] = url_title($values[$func_val], 'dash', TRUE);
}
else if (is_array($func_val))
{
$func = current($func_val);
$val = key($func_val);

if (!empty($values[$val]))
{
if (function_exists($func))
{
$values[$field] = call_user_func($func, $values[$val]);
}
else
{
$values[$field] = $values[$val];
}
}
}
}
}
return $values;
}

// --------------------------------------------------------------------

/**
Expand Down
8 changes: 4 additions & 4 deletions fuel/application/helpers/MY_date_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function datetime_now(){
function is_date_format($date)
{
return (is_string($date) AND (!empty($date) AND (int)$date != 0) AND
(is_english_format($date) OR is_db_format($date)));
(is_date_english_format($date) OR is_date_db_format($date)));
}

// --------------------------------------------------------------------
Expand All @@ -64,7 +64,7 @@ function is_date_format($date)
* @param string
* @return boolean
*/
function is_db_format($date)
function is_date_db_format($date)
{
return preg_match("#([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})#", $date);
}
Expand All @@ -78,7 +78,7 @@ function is_db_format($date)
* @param string
* @return boolean
*/
function is_english_format($date)
function is_date_english_format($date)
{
return preg_match("#([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})#", $date);
}
Expand Down Expand Up @@ -193,7 +193,7 @@ function time_verbose($time, $include_seconds = FALSE)
* @param string
* @return string
*/
function english_to_db_format($date, $hour = 0, $min = 0, $sec = 0, $ampm = 'am', $delimiter = '/')
function english_date_to_db_format($date, $hour = 0, $min = 0, $sec = 0, $ampm = 'am', $delimiter = '/')
{
$hour = (int) $hour;
$min = (int) $min;
Expand Down
6 changes: 4 additions & 2 deletions fuel/application/helpers/MY_string_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ function php_to_template_syntax($str)
// close ending php
$str = preg_replace('#([:|;])?\s*\?>#U', '}$3', $str);


$str = str_replace($find, $replace, $str);


// TODO javascript escape... commented out because it's problematic... will need to revisit if it makes sense'
//$str = preg_replace('#((?<!\{literal\}).*)<script(.+)>(.+)<\/script>.*(?!\{\\\literal\})#Us', "$1\n{literal}\n<script$2>$3</script>\n{\literal}\n", $str);

// foreach cleanup
$str = preg_replace('#{\s*foreach\s*\((\$\w+)\s+as\s+\$(\w+)\s*(=>\s*\$(\w+))?\)\s*}#U', '{foreach $1 $2 $4}', $str); // with and without keys

Expand Down
Loading

0 comments on commit 953f456

Please sign in to comment.