[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14020] booking: preserve datatype from input form
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14020] booking: preserve datatype from input form |
Date: |
Fri, 25 Sep 2015 13:57:17 +0000 |
Revision: 14020
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14020
Author: sigurdne
Date: 2015-09-25 13:57:17 +0000 (Fri, 25 Sep 2015)
Log Message:
-----------
booking: preserve datatype from input form
Modified Paths:
--------------
trunk/booking/inc/class.uiapplication_settings.inc.php
trunk/booking/inc/class.uibuilding.inc.php
trunk/booking/inc/class.uicommon.inc.php
trunk/booking/inc/class.uievent_mail_settings.inc.php
trunk/booking/inc/class.uigroup.inc.php
trunk/booking/inc/class.uimail_settings.inc.php
trunk/booking/inc/class.uimetasettings.inc.php
trunk/booking/inc/class.uiorganization.inc.php
trunk/booking/inc/class.uiresource.inc.php
trunk/booking/inc/class.uisystem_message.inc.php
Modified: trunk/booking/inc/class.uiapplication_settings.inc.php
===================================================================
--- trunk/booking/inc/class.uiapplication_settings.inc.php 2015-09-25
11:55:58 UTC (rev 14019)
+++ trunk/booking/inc/class.uiapplication_settings.inc.php 2015-09-25
13:57:17 UTC (rev 14020)
@@ -25,7 +25,7 @@
{
if (strlen(trim($value)) > 0)
{
- $config->value($dim,
trim($value));
+ $config->value($dim,
phpgw::clean_value($value));
}
else
{
Modified: trunk/booking/inc/class.uibuilding.inc.php
===================================================================
--- trunk/booking/inc/class.uibuilding.inc.php 2015-09-25 11:55:58 UTC (rev
14019)
+++ trunk/booking/inc/class.uibuilding.inc.php 2015-09-25 13:57:17 UTC (rev
14020)
@@ -27,7 +27,31 @@
$this->bo = CreateObject('booking.bobuilding');
$this->bo_booking = CreateObject('booking.bobooking');
self::set_active_menu('booking::buildings');
- $this->fields = array('name', 'homepage',
'description', 'email', 'tilsyn_name', 'tilsyn_email', 'tilsyn_phone',
'tilsyn_name2', 'tilsyn_email2', 'tilsyn_phone2', 'street', 'zip_code', 'city',
'district', 'phone', 'active',
'location_code','deactivate_application','deactivate_calendar','deactivate_sendmessage','extra_kalendar','calendar_text');
+ $this->fields = array
+ (
+ 'name'
=> 'string',
+ 'homepage'
=> 'url',
+ 'description' =>
'html',
+ 'email'
=> 'email',
+ 'tilsyn_name' =>
'string',
+ 'tilsyn_email' =>
'email',
+ 'tilsyn_phone' =>
'string',
+ 'tilsyn_name2' =>
'string',
+ 'tilsyn_email2' =>
'email',
+ 'tilsyn_phone2' =>
'string',
+ 'street'
=> 'string',
+ 'zip_code'
=> 'string',
+ 'city'
=> 'string',
+ 'district'
=> 'string',
+ 'phone'
=> 'string',
+ 'active'
=> 'int',
+ 'location_code' =>
'string',
+ 'deactivate_application' => 'int',
+ 'deactivate_calendar' => 'int',
+ 'deactivate_sendmessage' => 'int',
+ 'extra_kalendar' =>
'string',
+ 'calendar_text' =>
'string',
+ );
}
public function properties()
Modified: trunk/booking/inc/class.uicommon.inc.php
===================================================================
--- trunk/booking/inc/class.uicommon.inc.php 2015-09-25 11:55:58 UTC (rev
14019)
+++ trunk/booking/inc/class.uicommon.inc.php 2015-09-25 13:57:17 UTC (rev
14020)
@@ -19,16 +19,78 @@
);
$options = array_merge($default_options, $options);
-
$result = array();
- foreach($keys as $write_key)
+
+ $isIndexed = array_values($keys) === $arr;
+ if($isIndexed)
{
- $array_key =
$options['prefix'].$write_key.$options['suffix'];
- if(isset($array[$array_key]))
+ foreach($keys as $write_key)
{
- $result[($options['preserve_prefix'] ?
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ?
$options['suffix'] : '')] = phpgw::clean_value($array[$array_key]);
+ $array_key =
$options['prefix'].$write_key.$options['suffix'];
+ if(isset($array[$array_key]))
+ {
+ $result[($options['preserve_prefix'] ?
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ?
$options['suffix'] : '')] = phpgw::clean_value($array[$array_key]);
+ }
+
}
}
+ else
+ {
+ foreach($keys as $write_key => $type)
+ {
+ switch($type)
+ {
+ case 'bool':
+ case 'boolean':
+ $_type = 'bool';
+ break;
+ case 'int':
+ case 'integer':
+ case 'number':
+ $_type = 'int';
+ break;
+ case 'float':
+ case 'double':
+ $_type = 'float';
+ break;
+ /* Specific string types */
+ case 'color':
+ $_type = 'color';
+ break;
+ case 'email':
+ $_type = 'email';
+ break;
+ case 'filename':
+ $_type = 'filename';
+ break;
+ case 'ip':
+ $_type = 'ip';
+ break;
+ case 'location':
+ $_type = 'location';
+ break;
+ case 'url':
+ $_type = 'url';
+ break;
+ /* only use this if you really know
what you are doing */
+ case 'raw':
+ $_type = 'raw';
+ break;
+ case 'html':
+ $_type = 'html';
+ break;
+ default:
+ $_type = 'string';
+ break;
+ }
+ $array_key =
$options['prefix'].$write_key.$options['suffix'];
+ if(isset($array[$array_key]))
+ {
+ $result[($options['preserve_prefix'] ?
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ?
$options['suffix'] : '')] = phpgw::clean_value($array[$array_key],$_type);
+ }
+ }
+ }
+
return $result;
}
Modified: trunk/booking/inc/class.uievent_mail_settings.inc.php
===================================================================
--- trunk/booking/inc/class.uievent_mail_settings.inc.php 2015-09-25
11:55:58 UTC (rev 14019)
+++ trunk/booking/inc/class.uievent_mail_settings.inc.php 2015-09-25
13:57:17 UTC (rev 14020)
@@ -25,7 +25,7 @@
{
if (strlen(trim($value)) > 0)
{
- $config->value($dim,
trim($value));
+ $config->value($dim,
phpgw::clean_value($value));
}
else
{
Modified: trunk/booking/inc/class.uigroup.inc.php
===================================================================
--- trunk/booking/inc/class.uigroup.inc.php 2015-09-25 11:55:58 UTC (rev
14019)
+++ trunk/booking/inc/class.uigroup.inc.php 2015-09-25 13:57:17 UTC (rev
14020)
@@ -242,7 +242,17 @@
$errors = array();
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
- $group = array_merge($group,
extract_values($_POST, array('name', 'shortname', 'organization_id',
'organization_name', 'description', 'contacts', 'active', 'activity_id',
'show_in_portal')));
+ $group = array_merge($group,
extract_values($_POST, array(
+ 'name' =>
'string',
+ 'shortname' =>
'string',
+ 'organization_id' => 'string',
+ 'organization_name' => 'string',
+ 'description' => 'html',
+ 'contacts' =>
'string',
+ 'active' =>
'int',
+ 'activity_id' => 'int',
+ 'show_in_portal' => 'int',
+ )));
if (!isset($group["active"]))
{
$group['active'] = '1';
Modified: trunk/booking/inc/class.uimail_settings.inc.php
===================================================================
--- trunk/booking/inc/class.uimail_settings.inc.php 2015-09-25 11:55:58 UTC
(rev 14019)
+++ trunk/booking/inc/class.uimail_settings.inc.php 2015-09-25 13:57:17 UTC
(rev 14020)
@@ -25,7 +25,7 @@
{
if (strlen(trim($value)) > 0)
{
- $config->value($dim,
trim($value));
+ $config->value($dim,
phpgw::clean_value($value));
}
else
{
Modified: trunk/booking/inc/class.uimetasettings.inc.php
===================================================================
--- trunk/booking/inc/class.uimetasettings.inc.php 2015-09-25 11:55:58 UTC
(rev 14019)
+++ trunk/booking/inc/class.uimetasettings.inc.php 2015-09-25 13:57:17 UTC
(rev 14020)
@@ -25,7 +25,7 @@
{
if (strlen(trim($value)) > 0)
{
- $config->value($dim,
trim($value));
+ $config->value($dim,
phpgw::clean_value($value));
}
else
{
Modified: trunk/booking/inc/class.uiorganization.inc.php
===================================================================
--- trunk/booking/inc/class.uiorganization.inc.php 2015-09-25 11:55:58 UTC
(rev 14019)
+++ trunk/booking/inc/class.uiorganization.inc.php 2015-09-25 13:57:17 UTC
(rev 14020)
@@ -29,13 +29,26 @@
self::set_active_menu('booking::organizations');
$this->module = "booking";
- $this->fields = array('name', 'shortname', 'homepage',
'phone', 'email',
- 'street',
'zip_code', 'city', 'district',
-
'description', 'contacts', 'active',
-
'organization_number', 'activity_id',
-
'customer_number', 'customer_internal', 'show_in_portal');
-
-
+ $this->fields = array(
+ 'name' =>
'string',
+ 'shortname' =>
'string',
+ 'homepage' =>
'url',
+ 'phone' =>
'string',
+ 'email' =>
'email',
+ 'street' =>
'string',
+ 'zip_code' =>
'string',
+ 'city' =>
'string',
+ 'district' =>
'string',
+ 'description' => 'html',
+ 'contacts' =>
'string',
+ 'active' =>
'int',
+ 'organization_number' => 'string',
+ 'activity_id' => 'int',
+ 'customer_number' => 'string',
+ 'customer_internal' => 'int',
+ 'show_in_portal' => 'int',
+ );
+
}
public function building_users() {
Modified: trunk/booking/inc/class.uiresource.inc.php
===================================================================
--- trunk/booking/inc/class.uiresource.inc.php 2015-09-25 11:55:58 UTC (rev
14019)
+++ trunk/booking/inc/class.uiresource.inc.php 2015-09-25 13:57:17 UTC (rev
14020)
@@ -23,7 +23,17 @@
$this->bo = CreateObject('booking.boresource');
$this->activity_bo = CreateObject('booking.boactivity');
- $this->fields = array('name', 'building_id',
'building_name','description','activity_id', 'active', 'type', 'sort',
'organizations_ids');
+ $this->fields = array(
+ 'name'
=> 'string',
+ 'building_id' =>
'string',
+ 'building_name' =>
'string',
+ 'description' =>
'html',
+ 'activity_id' =>
'int',
+ 'active'
=> 'int',
+ 'type'
=> 'string',
+ 'sort'
=> 'string',
+ 'organizations_ids' =>
'string',
+ );
self::set_active_menu('booking::resources');
}
Modified: trunk/booking/inc/class.uisystem_message.inc.php
===================================================================
--- trunk/booking/inc/class.uisystem_message.inc.php 2015-09-25 11:55:58 UTC
(rev 14019)
+++ trunk/booking/inc/class.uisystem_message.inc.php 2015-09-25 13:57:17 UTC
(rev 14020)
@@ -247,7 +247,9 @@
$errors = array();
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
- $system_message = array_merge($system_message,
extract_values($_POST, array('time', 'title', 'message')));
+ $system_message = array_merge($system_message,
extract_values($_POST, array(
+ 'name' => 'string', 'time' => 'string',
'title' => 'string', 'message' => 'html', 'phone' => 'string', 'email' =>
'email')
+ ));
if (!isset($system_message["Status"]))
{
$system_message['status'] = 'NEW';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14020] booking: preserve datatype from input form,
Sigurd Nes <=