From da54ec855d65086aa453a482facce64bab07d8d5 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 23 Dec 2013 12:03:54 -0800 Subject: [PATCH] CRM-14023 CRM-14015 - Add apis for admin pages --- api/v3/Generic/Setvalue.php | 13 ++--- api/v3/PrintLabel.php | 77 +++++++++++++++++++++++++++++ api/v3/SmsProvider.php | 77 +++++++++++++++++++++++++++++ api/v3/utils.php | 22 +++++++-- templates/CRM/Badge/Page/Layout.tpl | 5 +- templates/CRM/SMS/Page/Provider.tpl | 2 +- 6 files changed, 179 insertions(+), 17 deletions(-) create mode 100644 api/v3/PrintLabel.php create mode 100644 api/v3/SmsProvider.php diff --git a/api/v3/Generic/Setvalue.php b/api/v3/Generic/Setvalue.php index 471e700aca..72cd6d41eb 100644 --- a/api/v3/Generic/Setvalue.php +++ b/api/v3/Generic/Setvalue.php @@ -31,14 +31,13 @@ function civicrm_api3_generic_setValue($apiRequest) { } switch ($def['type']) { - case 1: - //int + case CRM_Utils_Type::T_INT: if (!is_numeric($value)) { return civicrm_api3_create_error("Param '$field' must be a number", array('error_code' => 'NaN')); } - case 2: - //string + case CRM_Utils_Type::T_STRING: + case CRM_Utils_Type::T_TEXT: if (!CRM_Utils_Rule::xssString($value)) { return civicrm_api3_create_error(ts('Illegal characters in input (potential scripting attack)'), array('error_code' => 'XSS')); } @@ -47,15 +46,13 @@ function civicrm_api3_generic_setValue($apiRequest) { } break; - case 12: - //date + case CRM_Utils_Type::T_DATE: $value = CRM_Utils_Type::escape($value,"Date",false); if (!$value) return civicrm_api3_create_error("Param '$field' is not a date. format YYYYMMDD or YYYYMMDDHHMMSS"); break; - case 16: - //boolean + case CRM_Utils_Type::T_BOOLEAN: $value = (boolean) $value; break; diff --git a/api/v3/PrintLabel.php b/api/v3/PrintLabel.php new file mode 100644 index 0000000000..b059eba83c --- /dev/null +++ b/api/v3/PrintLabel.php @@ -0,0 +1,77 @@ + {foreach from=$rows item=row} - + {$row.title} - {$row.description} + {$row.description} {if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} diff --git a/templates/CRM/SMS/Page/Provider.tpl b/templates/CRM/SMS/Page/Provider.tpl index 55472c436e..eef86ff3b1 100644 --- a/templates/CRM/SMS/Page/Provider.tpl +++ b/templates/CRM/SMS/Page/Provider.tpl @@ -52,7 +52,7 @@ {ts}Action{/ts} {foreach from=$rows item=row} - + {$row.name} ({$row.title})
{ts}API Type:{/ts} {$row.api_type}
{ts}API Url:{/ts} {$row.api_url}
-- 2.25.1