Skip to content

Instantly share code, notes, and snippets.

@narfbg
narfbg / Email.php
Created October 15, 2012 08:38
CodeIgniter Email.php with patch from gist 3870694 applied
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
* Licensed under the Open Software License version 3.0
*
@narfbg
narfbg / prep_q_encoding.diff
Created October 11, 2012 07:06
RC Fix issues #1409 & #1498 (broken multibyte email headers)
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 698cb76..764d16d 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -98,7 +98,7 @@ class CI_Email {
*/
public function __construct($config = array())
{
- $this->charset = strtoupper(config_item('charset'));
+ $this->charset = config_item('charset');
@narfbg
narfbg / proxies-fix.diff
Created August 15, 2012 12:08
Subnetted proxies fix
diff --git a/system/core/Input.php b/system/core/Input.php
index 968a42a..c3d8980 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -328,34 +328,42 @@ class CI_Input {
return $this->ip_address;
}
- if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR'))
+ $proxies = config_item('proxy_ips');
@narfbg
narfbg / fix-empty-rules.diff
Created July 2, 2012 12:41
CodeIgniter Form validation library, empty rules
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 3536241..70421ce 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -459,6 +459,10 @@ class CI_Form_validation {
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
+ elseif ( ! empty($row['rules']))
+ {
@narfbg
narfbg / redirect_303.patch
Created June 16, 2012 19:51
CI redirect() HTTP code 303 auto-detection
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 40ce807..add7f72 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -526,7 +526,7 @@ if ( ! function_exists('redirect'))
* @param int
* @return string
*/
- function redirect($uri = '', $method = 'auto', $http_response_code = 302)
+ function redirect($uri = '', $method = 'auto', $code = NULL)
@narfbg
narfbg / valid_email.patch
Created June 7, 2012 09:30
CI_Email::valid_email() hostname validation
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index c70144f..8968a84 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -704,11 +704,37 @@ class CI_Email {
* Email Validation
*
* @param string
+ * @param mixed types of records to check
* @return bool
@narfbg
narfbg / join-multiple.patch
Created June 5, 2012 21:19
CodeIgniter QB join() with multiple conditions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 7a0ea0c..cefaa77 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -343,8 +343,26 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
// in the protect_identifiers to know whether to add a table prefix
$this->_track_aliases($table);
- // Strip apart the condition and protect the identifiers
- if (preg_match('/([\[\w\.]+)([\W\s]+)(.+)/', $cond, $match))
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|images\/.+\.(jpg|png|gif)|css\/.+\.(css|jpg|png|gif)|js\/.+\.js|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
#!/bin/bash
/sbin/iptables -A INPUT -s "$1" -j DROP