Skip to content

Commit

Permalink
civix upgrade; change name in composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
gshilin committed Sep 27, 2024
1 parent f0ffd81 commit afd8825
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 17 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified bbsms.civix.php
100644 → 100755
Empty file.
Empty file modified bbsms.php
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bb/bbsms",
"description": "(BBSMS) BB civicrm sms extention",
"version": "2.0.0",
"name": "bb/bb-sms",
"description": "BB SMS Delivery Gateway",
"version": "2.0.1",
"type": "civicrm-ext",
"homepage": "https://github.com/Bnei-Baruch/bbsms",
"license": "AGPL-3.0",
Expand All @@ -13,3 +13,4 @@
}
]
}

Empty file modified images/screenshot.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions info.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<email>gshilin@gmail.com</email>
</maintainer>
<releaseDate>2018-12-02</releaseDate>
<version>1.0</version>
<develStage>alpha</develStage>
<version>2.0.1</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
</compatibility>
<comments>This is a new, undeveloped module</comments>
<comments></comments>
</extension>
12 changes: 1 addition & 11 deletions info_kabbalah_bbSMS.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
class info_kabbalah_bbSMS extends CRM_SMS_Provider
{

CONST MAX_SMS_CHAR = 459;

/**
* api type to use to send a message
* @var string
Expand Down Expand Up @@ -133,7 +131,6 @@ function __construct($provider = array(), $skipAuth = FALSE)
// initialize vars
$this->_apiType = CRM_Utils_Array::value('api_type', $provider, 'http');
$this->_providerInfo = $provider;
CRM_Core_Error::debug_log_message("bbSMS: constructor");

/**
* Reuse the curl handle
Expand Down Expand Up @@ -196,7 +193,6 @@ function send($recipients, $header, $message, $jobID = NULL, $userID = NULL)
CRM_Core_Error::debug_log_message("bbSMS: send to " . var_export($recipients, true));

if ($this->_apiType == 'http') {
CRM_Core_Error::debug_log_message("bbSMS: send http");
$url = $this->_providerInfo['api_url'];
$message_text = preg_replace( "/\r|\n/", "", $message); // remove line breaks
$xml = '';
Expand All @@ -216,16 +212,14 @@ function send($recipients, $header, $message, $jobID = NULL, $userID = NULL)
$xml .= ' <Sender>' . htmlspecialchars($this->_providerInfo['api_params']['sender']) . '</Sender>' . PHP_EOL;
$xml .= ' </Settings>' . PHP_EOL;
$xml .= '</Inforu>' . PHP_EOL;
CRM_Core_Error::debug_log_message("bbSMS: send xml: " . $xml);

$postData = urlencode($xml);
$response = $this->curl($url, $postData);
CRM_Core_Error::debug_log_message("bbSMS: send curl: " . var_export($response, true));
if ($response['error']) {
$errorMessage = $response['error'];
CRM_Core_Session::setStatus(ts($errorMessage), ts('Sending SMS Error'), 'error');
// TODO: Should add a failed activity instead.
CRM_Core_Error::debug_log_message($response . " - for one of: {$recipients}");
CRM_Core_Error::debug_log_message($response . " - for phone: {$header['To']}");
return false;
} else {
$this->createActivity(0, $message, $header, $jobID, $userID);
Expand Down Expand Up @@ -254,7 +248,6 @@ function curl($url, $postData)

// Send the data out over the wire
$response = curl_exec($this->_ch);
CRM_Core_Error::debug_log_message("bbSMS: curl: " . var_export($response), true);

if (!$response) {
$errorMessage = 'Error: "' . curl_error($this->_ch) . '" - Code: ' . curl_errno($this->_ch);
Expand All @@ -266,11 +259,9 @@ function curl($url, $postData)
return $response;
}

CRM_Core_Error::debug_log_message("bbSMS: curl before parsing ");
$xmlparser = xml_parser_create();
xml_parse_into_struct($xmlparser, $response, $values);
xml_parser_free($xmlparser);
CRM_Core_Error::debug_log_message("bbSMS: curl after parsing " . var_export($values, true));
$result = array();
for ($i = 0; $i < count($values); $i++) {
$v = $values[$i];
Expand All @@ -280,7 +271,6 @@ function curl($url, $postData)
$result['description'] = $v['value'];
}
}
CRM_Core_Error::debug_log_message("bbSMS: curl result " . var_export($result, true));
return $result;
}

Expand Down

0 comments on commit afd8825

Please sign in to comment.