diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..d19e84a3fe
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+resources/config.php
+secure/mailto.bat
+secure/*.db
+secure/*.sqlite
diff --git a/app/calls_active/calls_active_inc.php b/app/calls_active/calls_active_inc.php
index 0418c94a1f..4891ec0dc6 100644
--- a/app/calls_active/calls_active_inc.php
+++ b/app/calls_active/calls_active_inc.php
@@ -183,6 +183,11 @@ else {
}
}
+ // reduce too long app data
+ if(strlen($application_data) > 512) {
+ $application_data = substr($application_data, 0, 512) . ' ...';
+ }
+
echo "
\n";
echo "| ".$sip_profile." | \n";
echo "".$created." | \n";
diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php
index bb08fa837d..cd9a80b589 100644
--- a/app/fax/fax_files.php
+++ b/app/fax/fax_files.php
@@ -35,10 +35,8 @@ else {
}
//add multi-lingual support
- require_once "app_languages.php";
- foreach($text as $key => $value) {
- $text[$key] = $value[$_SESSION['domain']['language']['code']];
- }
+ $language = new text;
+ $text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
diff --git a/app/operator_panel/index_inc.php b/app/operator_panel/index_inc.php
index e28c3f4425..2c58342155 100644
--- a/app/operator_panel/index_inc.php
+++ b/app/operator_panel/index_inc.php
@@ -173,8 +173,8 @@ foreach ($activity as $extension => $ext) {
$call_number = $ext['dest'];
}
else {
- $call_name = $activity[(int) $ext['dest']]['effective_caller_id_name'];
- $call_number = format_phone((int) $ext['dest']);
+ $call_name = $activity[$ext['dest']]['effective_caller_id_name'];
+ $call_number = format_phone($ext['dest']);
}
$dir_icon = 'outbound';
}
@@ -182,13 +182,13 @@ foreach ($activity as $extension => $ext) {
if ($ext['callstate'] == 'ACTIVE') {
$ext_state = 'active';
if ($ext['direction'] == 'inbound') {
- $call_name = $activity[(int) $ext['dest']]['effective_caller_id_name'];
- $call_number = format_phone((int) $ext['dest']);
+ $call_name = $activity[$ext['dest']]['effective_caller_id_name'];
+ $call_number = format_phone($ext['dest']);
$dir_icon = 'outbound';
}
else if ($ext['direction'] == 'outbound') {
- $call_name = $activity[(int) $ext['cid_num']]['effective_caller_id_name'];
- $call_number = format_phone((int) $ext['cid_num']);
+ $call_name = $activity[$ext['cid_num']]['effective_caller_id_name'];
+ $call_number = format_phone($ext['cid_num']);
$dir_icon = 'inbound';
}
}
@@ -201,8 +201,8 @@ foreach ($activity as $extension => $ext) {
$ext_state = 'active';
}
$dir_icon = 'inbound';
- $call_name = $activity[(int) $ext['cid_num']]['effective_caller_id_name'];
- $call_number = format_phone((int) $ext['cid_num']);
+ $call_name = $activity[$ext['cid_num']]['effective_caller_id_name'];
+ $call_number = format_phone($ext['cid_num']);
}
else {
unset($ext_state, $dir_icon, $call_name, $call_number);
diff --git a/resources/classes/cache.php b/resources/classes/cache.php
index 689fe7199a..077cfd9599 100644
--- a/resources/classes/cache.php
+++ b/resources/classes/cache.php
@@ -33,17 +33,23 @@ class cache {
* @var string $value string to be cached
*/
public function set($key, $value) {
- //send a custom event
-
- //run the memcache
+ // connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $command = "memcache set ".$key." ".$value;
- return event_socket_request($fp, 'api '.$command);
- }
- else {
+ if ($fp === false) {
return false;
}
+
+ //send a custom event
+
+ //run the memcache
+ $command = "memcache set ".$key." ".$value;
+ $result = event_socket_request($fp, 'api '.$command);
+
+ //close event socket
+ fclose($fp);
+
+ // return result
+ return $result;
}
/**
@@ -51,17 +57,23 @@ class cache {
* @var string $key cache id
*/
public function get($key) {
- //send a custom event
-
- //run the memcache
+ // connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $command = "memcache get ".$key;
- return event_socket_request($fp, 'api '.$command);
- }
- else {
+ if ($fp === false) {
return false;
}
+
+ //send a custom event
+
+ //run the memcache
+ $command = "memcache get ".$key;
+ $result = event_socket_request($fp, 'api '.$command);
+
+ //close event socket
+ fclose($fp);
+
+ // return result
+ return $result;
}
/**
@@ -69,52 +81,58 @@ class cache {
* @var string $key cache id
*/
public function delete($key) {
- //send a custom event
+ // connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $event = "sendevent CUSTOM\n";
- $event .= "Event-Name: MEMCACHE\n";
- $event .= "Event-Subclass: delete\n";
- $event .= "API-Command: memcache\n";
- $event .= "API-Command-Argument: delete ".$key."\n";
- echo event_socket_request($fp, $event);
- }
-
- //run the memcache
- $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $command = "memcache delete ".$key;
- return event_socket_request($fp, 'api '.$command);
- }
- else {
+ if ($fp === false) {
return false;
}
+
+ //send a custom event
+ $event = "sendevent CUSTOM\n";
+ $event .= "Event-Name: MEMCACHE\n";
+ $event .= "Event-Subclass: delete\n";
+ $event .= "API-Command: memcache\n";
+ $event .= "API-Command-Argument: delete ".$key."\n";
+ event_socket_request($fp, $event);
+
+ //run the memcache
+ $command = "memcache delete ".$key;
+ $result = event_socket_request($fp, 'api '.$command);
+
+ //close event socket
+ fclose($fp);
+
+ // return result
+ return $result;
}
/**
* Delete the entire cache
*/
public function flush() {
- //send a custom event
+ // connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $event = "sendevent CUSTOM\n";
- $event .= "Event-Name: MEMCACHE\n";
- $event .= "Event-Subclass: flush\n";
- $event .= "API-Command: memcache\n";
- $event .= "API-Command-Argument: flush\n";
- echo event_socket_request($fp, $event);
- }
-
- //run the memcache
- $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $command = "memcache flush";
- return event_socket_request($fp, 'api '.$command);
- }
- else {
+ if ($fp === false) {
return false;
}
+
+ //send a custom event
+ $event = "sendevent CUSTOM\n";
+ $event .= "Event-Name: MEMCACHE\n";
+ $event .= "Event-Subclass: flush\n";
+ $event .= "API-Command: memcache\n";
+ $event .= "API-Command-Argument: flush\n";
+ event_socket_request($fp, $event);
+
+ //run the memcache
+ $command = "memcache flush";
+ $result = event_socket_request($fp, 'api '.$command);
+
+ //close event socket
+ fclose($fp);
+
+ // return result
+ return $result;
}
}