Skip to content

Commit

Permalink
CI3 update + closes donjakobo#56
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Sep 4, 2013
1 parent 28700df commit 1aa6e90
Show file tree
Hide file tree
Showing 22 changed files with 55 additions and 117 deletions.
2 changes: 0 additions & 2 deletions a3m_database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ CREATE TABLE IF NOT EXISTS `a3m_account` (

CREATE TABLE IF NOT EXISTS `a3m_account_details` (
`account_id` bigint(20) unsigned NOT NULL,
`fullname` varchar(160) DEFAULT NULL,
`firstname` varchar(80) DEFAULT NULL,
`lastname` varchar(80) DEFAULT NULL,
`dateofbirth` date DEFAULT NULL,
`gender` char(1) DEFAULT NULL,
`postalcode` varchar(40) DEFAULT NULL,
`country` char(2) DEFAULT NULL,
`language` char(2) DEFAULT NULL,
`timezone` varchar(40) DEFAULT NULL,
Expand Down
60 changes: 33 additions & 27 deletions application/config/foreign_chars.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Ё|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|ё|э/' => 'e',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г/' => 'g',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Й/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|й/' => 'i',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
Expand All @@ -80,18 +80,18 @@
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ/' => 'Y',
'/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ/' => 'y',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ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я/' => 'ya'
);

/* End of file foreign_chars.php */
Expand Down
3 changes: 1 addition & 2 deletions application/controllers/account/Account_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function index()

// Setup form validation
$this->form_validation->set_error_delimiters('<div class="field_error">', '</div>');
$this->form_validation->set_rules(array(array('field' => 'settings_email', 'label' => 'lang:settings_email', 'rules' => 'trim|required|valid_email|max_length[160]'), array('field' => 'settings_fullname', 'label' => 'lang:settings_fullname', 'rules' => 'trim|max_length[160]'), array('field' => 'settings_firstname', 'label' => 'lang:settings_firstname', 'rules' => 'trim|max_length[80]'), array('field' => 'settings_lastname', 'label' => 'lang:settings_lastname', 'rules' => 'trim|max_length[80]'), array('field' => 'settings_postalcode', 'label' => 'lang:settings_postalcode', 'rules' => 'trim|max_length[40]')));
$this->form_validation->set_rules(array(array('field' => 'settings_email', 'label' => 'lang:settings_email', 'rules' => 'trim|required|valid_email|max_length[160]'), array('field' => 'settings_firstname', 'label' => 'lang:settings_firstname', 'rules' => 'trim|max_length[80]'), array('field' => 'settings_lastname', 'label' => 'lang:settings_lastname', 'rules' => 'trim|max_length[80]')));

// Run form validation
if ($this->form_validation->run())
Expand All @@ -82,7 +82,6 @@ function index()
$this->input->post('settings_dob_day', TRUE) &&
$this->input->post('settings_dob_year', TRUE)) $attributes['dateofbirth'] = mdate('%Y-%m-%d', strtotime($this->input->post('settings_dob_day', TRUE).'-'.$this->input->post('settings_dob_month', TRUE).'-'.$this->input->post('settings_dob_year', TRUE)));

$attributes['fullname'] = $this->input->post('settings_fullname', TRUE) ? $this->input->post('settings_fullname', TRUE) : NULL;
$attributes['firstname'] = $this->input->post('settings_firstname', TRUE) ? $this->input->post('settings_firstname', TRUE) : NULL;
$attributes['lastname'] = $this->input->post('settings_lastname', TRUE) ? $this->input->post('settings_lastname', TRUE) : NULL;
$attributes['gender'] = $this->input->post('settings_gender', TRUE) ? $this->input->post('settings_gender', TRUE) : NULL;
Expand Down
19 changes: 3 additions & 16 deletions application/controllers/admin/Manage_permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ function save($id=null)
$data['role_permissions'] = $this->rel_role_permission_model->get_by_permission_id($id);
$data['action'] = 'update';
$data['is_system'] = ($data['permission']->is_system == 1);
$data['is_disabled'] = isset( $data['permission']->suspendedon );
}

// Setup form validation
Expand Down Expand Up @@ -177,12 +176,11 @@ function save($id=null)
// Check if the permission should be disabled
if( $this->authorization->is_permitted('delete_permissions') )
{
$permission_ban = $this->input->post('manage_permission_ban', TRUE);
if( isset($permission_ban) )
if( $this->input->post('manage_permission_ban', TRUE) )
{
$this->acl_permission_model->update_suspended_datetime($id);
}
else
elseif( $this->input->post('manage_permission_unban', TRUE) )
{
$this->acl_permission_model->remove_suspended_datetime($id);
}
Expand All @@ -202,18 +200,7 @@ function save($id=null)
}
}

if( $is_new )
{
// Redirect to view the newly created role
redirect("admin/manage_permissions/save/{$id}");
}
else
{
// Permission information may have been updated, re-get
$data['permission'] = $this->acl_permission_model->get_by_id($id);
$data['role_permissions'] = $this->rel_role_permission_model->get_by_permission_id($id);
$data['is_disabled'] = isset( $data['permission']->suspendedon );
}
redirect('admin/manage_permissions');
}
}
// Load manage permissions view
Expand Down
16 changes: 3 additions & 13 deletions application/controllers/admin/Manage_roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ function save($id=null)
if( $this->authorization->is_permitted('delete_roles') )
{
$permission_ban = $this->input->post('manage_role_ban', TRUE);
if( isset($permission_ban) )
if( $this->input->post('manage_role_ban', TRUE) )
{
$this->acl_role_model->update_suspended_datetime($id);
}
else
elseif( $this->input->post('manage_role_unban', TRUE))
{
$this->acl_role_model->remove_suspended_datetime($id);
}
Expand All @@ -197,17 +197,7 @@ function save($id=null)
}
$this->rel_role_permission_model->delete_update_batch($id, $perms);

if( $is_new )
{
// Redirect to view the newly created role
redirect("admin/manage_roles/save/{$id}");
}
else
{
// Role information may have been updated, re-get
$data['role'] = $this->acl_role_model->get_by_id($id);
$data['role_permissions'] = $this->rel_role_permission_model->get_by_role_id($id);
}
redirect('admin/manage_roles');
}
}

Expand Down
17 changes: 3 additions & 14 deletions application/controllers/admin/Manage_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ function save($id=null)
if( $this->authorization->is_permitted('ban_users') )
{
$ban = $this->input->post('manage_user_ban', TRUE);
if( isset($ban) )
if( $this->input->post('manage_user_ban', true) )
{
$this->account_model->update_suspended_datetime($id);
}
else
elseif( $this->input->post('manage_user_unban', true) )
{
$this->account_model->remove_suspended_datetime($id);
}
Expand All @@ -253,18 +253,7 @@ function save($id=null)
}
$this->rel_account_role_model->delete_update_batch($id, $roles);

if( $is_new )
{
// Redirect to view the newly created user
redirect("admin/manage_users/save/{$id}");
}
else
{
// User information may have been updated, re-get
$data['update_account'] = $this->account_model->get_by_id($id);
$data['update_account_details'] = $this->account_details_model->get_by_account_id($id);
$data['update_account_roles'] = $this->acl_role_model->get_by_account_id($id);
}
redirect("admin/manage_users");
}
}

Expand Down
3 changes: 0 additions & 3 deletions application/models/account/Account_details_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function get_by_account_id($account_id)
*/
function update($account_id, $attributes = array())
{
if (isset($attributes['fullname'])) if (strlen($attributes['fullname']) > 160) $attributes['fullname'] = substr($attributes['fullname'], 0, 160);
if (isset($attributes['firstname'])) if (strlen($attributes['firstname']) > 80) $attributes['firstname'] = substr($attributes['firstname'], 0, 80);
if (isset($attributes['lastname'])) if (strlen($attributes['lastname']) > 80) $attributes['lastname'] = substr($attributes['lastname'], 0, 80);
if (isset($attributes['dateofbirth']))
Expand All @@ -59,7 +58,6 @@ function update($account_id, $attributes = array())
break;
}
}
if (isset($attributes['postalcode'])) if (strlen($attributes['postalcode']) > 40) $attributes['postalcode'] = substr($attributes['postalcode'], 0, 40);
// Check that it's a recognized country (see http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
if (isset($attributes['country']))
{
Expand All @@ -85,7 +83,6 @@ function update($account_id, $attributes = array())
$this->load->model('account/ref_zoneinfo_model');
$timezone = $this->ref_zoneinfo_model->get_by_zoneinfo($attributes['timezone']);
$timezone ? $attributes['timezone'] = $timezone->zoneinfo : NULL;
$timezone ? $attributes['citimezone'] = $timezone->cicode : NULL;

// Try to guess country based on timezone
if ( ! isset($attributes['country']))
Expand Down
30 changes: 0 additions & 30 deletions application/views/account/account_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,6 @@
</div>
</div>

<div class="control-group <?php echo (form_error('settings_fullname')) ? 'error' : ''; ?>">
<label class="control-label" for="settings_fullname"><?php echo lang('settings_fullname'); ?></label>

<div class="controls">
<?php echo form_input(array('name' => 'settings_fullname', 'id' => 'settings_fullname', 'value' => set_value('settings_fullname') ? set_value('settings_fullname') : (isset($account_details->fullname) ? $account_details->fullname : ''), 'maxlength' => 160)); ?>
<?php if (form_error('settings_fullname'))
{
?>
<span class="help-inline">
<?php echo form_error('settings_fullname'); ?>
</span>
<?php } ?>
</div>
</div>

<div class="control-group <?php echo (form_error('settings_firstname')) ? 'error' : ''; ?>">
<label class="control-label" for="settings_firstname"><?php echo lang('settings_firstname'); ?></label>

Expand Down Expand Up @@ -149,21 +134,6 @@
</div>
</div>

<div class="control-group <?php echo (form_error('settings_postalcode')) ? 'error' : ''; ?>">
<label class="control-label" for="settings_postalcode"><?php echo lang('settings_postalcode'); ?></label>

<div class="controls">
<?php echo form_input(array('name' => 'settings_postalcode', 'id' => 'settings_postalcode', 'value' => set_value('settings_postalcode') ? set_value('settings_postalcode') : (isset($account_details->postalcode) ? $account_details->postalcode : ''), 'maxlength' => 40, 'class' => 'input-small')); ?>
<?php if (form_error('settings_postalcode'))
{
?>
<span class="help-inline">
<?php echo form_error('settings_postalcode'); ?>
</span>
<?php } ?>
</div>
</div>

<div class="control-group <?php echo (form_error('settings_country')) ? 'error' : ''; ?>">
<label class="control-label" for="settings_country"><?php echo lang('settings_country'); ?></label>

Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/manage_permissions_save.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
if( $this->authorization->is_permitted('delete_permissions') && $action == 'update' && ! $is_system )
{
echo '<span>' . lang('admin_or') . '</span>';
if( $is_disabled ){
if( isset($permission->suspendedon) ){
echo form_submit('manage_permission_unban', lang('permissions_unban'), 'class="btn btn-danger"');
} else {
echo form_submit('manage_permission_ban', lang('permissions_ban'), 'class="btn btn-danger"');
Expand Down
Binary file modified user_guide_src/build/doctrees/changelog.doctree
Binary file not shown.
Binary file modified user_guide_src/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified user_guide_src/build/doctrees/libraries/form_validation.doctree
Binary file not shown.
3 changes: 2 additions & 1 deletion user_guide_src/build/html/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<body>
<div id="table-contents">
<div class="toctree-wrapper compound">
<function <lambda> at 0x3a97578>
<function <lambda> at 0x4b4c140>
</div>
</div>

Expand Down Expand Up @@ -673,6 +673,7 @@ <h3>Bug fixes for 3.0<a class="headerlink" href="#bug-fixes-for-3-0" title="Perm
<li>Fixed a bug (#2585) - <a class="reference internal" href="database/query_builder.html"><em>Query Builder</em></a> methods <tt class="docutils literal"><span class="pre">min()</span></tt>, <tt class="docutils literal"><span class="pre">max()</span></tt>, <tt class="docutils literal"><span class="pre">avg()</span></tt>, <tt class="docutils literal"><span class="pre">sum()</span></tt> didn&#8217;t escape field names.</li>
<li>Fixed an edge case (#2583) in the <a class="reference internal" href="libraries/email.html"><em>Email Library</em></a> where <cite>Suhosin &lt;http://www.hardened-php.net/suhosin/&gt;</cite> blocked messages sent via <tt class="docutils literal"><span class="pre">mail()</span></tt> due to trailing newspaces in headers.</li>
<li>Fixed a bug (#2590) - <a class="reference internal" href="general/common_functions.html#log_message" title="log_message"><tt class="xref php php-func docutils literal"><span class="pre">log_message()</span></tt></a> didn&#8217;t actually cache the <tt class="docutils literal"><span class="pre">CI_Log</span></tt> class instance.</li>
<li>Fixed a bug (#2609) - <tt class="xref php php-func docutils literal"><span class="pre">get_config()</span></tt> optional argument was only effective on first function call. Also, it can now add items, in addition to updating existing items.</li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<body>
<div id="table-contents">
<div class="toctree-wrapper compound">
<function <lambda> at 0x40bc668>
<function <lambda> at 0x4c24500>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<body>
<div id="table-contents">
<div class="toctree-wrapper compound">
<function <lambda> at 0x3deed70>
<function <lambda> at 0x3497d70>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/build/html/libraries/form_validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<body>
<div id="table-contents">
<div class="toctree-wrapper compound">
<function <lambda> at 0x22e40c8>
<function <lambda> at 0x32dbed8>
</div>
</div>

Expand Down Expand Up @@ -539,7 +539,7 @@ <h3><a class="toc-backref" href="#id19">Callbacks: Your own Validation Methods</
<span class="p">}</span>
<span class="p">}</span>

<span class="k">protected</span> <span class="k">function</span> <span class="nf">username_check</span><span class="p">(</span><span class="nv">$str</span><span class="p">)</span>
<span class="k">public</span> <span class="k">function</span> <span class="nf">username_check</span><span class="p">(</span><span class="nv">$str</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$str</span> <span class="o">==</span> <span class="s1">&#39;test&#39;</span><span class="p">)</span>
<span class="p">{</span>
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/build/html/libraries/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<body>
<div id="table-contents">
<div class="toctree-wrapper compound">
<function <lambda> at 0x2248f50>
<function <lambda> at 0x4773b18>
</div>
</div>

Expand Down
Binary file modified user_guide_src/build/html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion user_guide_src/build/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<body>
<div id="table-contents">
<div class="toctree-wrapper compound">
<function <lambda> at 0x40bc668>
<function <lambda> at 0x4c24500>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/build/html/searchindex.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions user_guide_src/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ Bug fixes for 3.0
- Fixed a bug (#2585) - :doc:`Query Builder <database/query_builder>` methods ``min()``, ``max()``, ``avg()``, ``sum()`` didn't escape field names.
- Fixed an edge case (#2583) in the :doc:`Email Library <libraries/email>` where `Suhosin <http://www.hardened-php.net/suhosin/>` blocked messages sent via ``mail()`` due to trailing newspaces in headers.
- Fixed a bug (#2590) - :php:func:`log_message()` didn't actually cache the ``CI_Log`` class instance.
- Fixed a bug (#2609) - :php:func:`get_config()` optional argument was only effective on first function call. Also, it can now add items, in addition to updating existing items.

Version 2.1.4
=============
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/libraries/form_validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ Here's how your controller should now look::
}
}

protected function username_check($str)
public function username_check($str)
{
if ($str == 'test')
{
Expand Down

0 comments on commit 1aa6e90

Please sign in to comment.