Skip to content
Snippets Groups Projects
Commit cef15991 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #53 from greezybacon/issue/53

Reviewed By: peter Rotich 07/08/12
parents 8ce6c09e bf0c87de
No related branches found
No related tags found
No related merge requests found
......@@ -172,10 +172,15 @@ class Validator {
return false;
$ip=trim($ip);
if(preg_match("/^[0-9]{1,3}(.[0-9]{1,3}){3}$/",$ip)) {
foreach(explode(".", $ip) as $block)
if($block<0 || $block>255 )
return false;
# Thanks to http://stackoverflow.com/a/1934546
if (function_exists('inet_pton')) { # PHP 5.1.0
# Let the built-in library parse the IP address
return @inet_pton($ip) !== false;
} else if (preg_match(
'/^(?>(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.*[a-f0-9](?>:|$)){7,})'
.'((?1)(?>:(?1)){0,5})?::(?2)?)|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){5,})'
.'(?3)?::(?>((?1)(?>:(?1)){0,3}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])'
.'(?>\.(?4)){3}))$/iD', $ip)) {
return true;
}
return false;
......
/**
* Change IP address columns to have sufficient room to store IPv6 address
*
* @version 1.7-rc1 ipv6-addresses
*/
ALTER TABLE `%TABLE_PREFIX%api_key`
CHANGE `ipaddr` `ipaddr` varchar(64) NOT NULL;
ALTER TABLE `%TABLE_PREFIX%session`
CHANGE `user_id` `user_id` int(10) unsigned NOT NULL default '0'
COMMENT 'osTicket staff ID',
CHANGE `user_ip` `user_ip` varchar(64) NOT NULL;
ALTER TABLE `%TABLE_PREFIX%syslog`
CHANGE `ip_address` `ip_address` varchar(64) NOT NULL;
ALTER TABLE `%TABLE_PREFIX%ticket`
CHANGE `ip_address` `ip_address` varchar(64) NOT NULL default '';
-- Finished with patch
UPDATE `%TABLE_PREFIX%config`
SET `schema_signature`='b19dc97d19f7a30f59663c812d1f3ddc';
......@@ -63,7 +63,7 @@
#Current version && schema signature (Changes from version to version)
define('THIS_VERSION','1.7-DPR4'); //Shown on admin panel
define('SCHEMA_SIGNATURE','aa4664afc3b43d4068eb2e82684fc28e'); //MD5 signature of the db schema. (used to trigger upgrades)
define('SCHEMA_SIGNATURE','b19dc97d19f7a30f59663c812d1f3ddc'); //MD5 signature of the db schema. (used to trigger upgrades)
#load config info
$configfile='';
......
......@@ -3,7 +3,7 @@ DROP TABLE IF EXISTS `%TABLE_PREFIX%api_key`;
CREATE TABLE `%TABLE_PREFIX%api_key` (
`id` int(10) unsigned NOT NULL auto_increment,
`isactive` tinyint(1) NOT NULL default '1',
`ipaddr` varchar(16) NOT NULL,
`ipaddr` varchar(64) NOT NULL,
`apikey` varchar(255) NOT NULL,
`notes` text,
`updated` datetime NOT NULL,
......@@ -423,9 +423,8 @@ CREATE TABLE `%TABLE_PREFIX%session` (
`session_data` longtext collate utf8_unicode_ci,
`session_expire` datetime default NULL,
`session_updated` datetime default NULL,
`user_id` int(10) unsigned NOT NULL default '0' COMMENT 'osTicket staff
ID',
`user_ip` varchar(32) collate utf8_unicode_ci NOT NULL,
`user_id` int(10) unsigned NOT NULL default '0' COMMENT 'osTicket staff ID',
`user_ip` varchar(64) NOT NULL,
`user_agent` varchar(255) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`session_id`),
KEY `updated` (`session_updated`),
......@@ -497,7 +496,7 @@ CREATE TABLE `%TABLE_PREFIX%syslog` (
`title` varchar(255) NOT NULL,
`log` text NOT NULL,
`logger` varchar(64) NOT NULL,
`ip_address` varchar(16) NOT NULL,
`ip_address` varchar(64) NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`log_id`),
......@@ -546,7 +545,7 @@ CREATE TABLE `%TABLE_PREFIX%ticket` (
`subject` varchar(64) NOT NULL default '[no subject]',
`phone` varchar(16) default NULL,
`phone_ext` varchar(8) default NULL,
`ip_address` varchar(16) NOT NULL default '',
`ip_address` varchar(64) NOT NULL default '',
`status` enum('open','closed') NOT NULL default 'open',
`source` enum('Web','Email','Phone','API','Other') NOT NULL default
'Other',
......
aa4664afc3b43d4068eb2e82684fc28e
b19dc97d19f7a30f59663c812d1f3ddc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment